http://www.geeksforgeeks.org/find-the-two-numbers-with-odd-occurences-in-an-unsorted-array/

 #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <string>
#include <fstream>
#include <map>
using namespace std; void printtwoodd(int arr[], int n) {
int x = arr[];
for (int i = ; i < n; i++) x ^= arr[i];
x &= ~(x-);
int ans1, ans2;
ans1 = ans2 = ;
for (int i = ; i < n; i++) {
if (arr[i] & x) ans1 ^= arr[i];
else ans2 ^= arr[i];
}
cout << ans1 << " " << ans2 << endl;
} int main() {
int arr[] = {, , , , , , , };
printtwoodd(arr, );
return ;
}

Data Structure Array: Find the two numbers with odd occurrences in an unsorted array的更多相关文章

  1. [Algorithm] Heap data structure and heap sort algorithm

    Source, git Heap is a data structure that can fundamentally change the performance of fairly common ...

  2. [LeetCode] 170. Two Sum III - Data structure design 两数之和之三 - 数据结构设计

    Design and implement a TwoSum class. It should support the following operations:add and find. add - ...

  3. [LeetCode] Two Sum III - Data structure design 两数之和之三 - 数据结构设计

    Design and implement a TwoSum class. It should support the following operations:add and find. add - ...

  4. ✡ leetcode 170. Two Sum III - Data structure design 设计two sum模式 --------- java

    Design and implement a TwoSum class. It should support the following operations: add and find. add - ...

  5. LeetCode Two Sum III - Data structure design

    原题链接在这里:https://leetcode.com/problems/two-sum-iii-data-structure-design/ 题目: Design and implement a ...

  6. LeetCode 笔记27 Two Sum III - Data structure design

    Design and implement a TwoSum class. It should support the following operations: add and find. add - ...

  7. hdu 4217 Data Structure? 树状数组求第K小

    Data Structure? Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  8. leetcode3 Two Sum III – Data structure design

    Question: Design and implement a TwoSum class. It should support the following operations: add and f ...

  9. 170. Two Sum III - Data structure design

    题目: Design and implement a TwoSum class. It should support the following operations: add and find. a ...

随机推荐

  1. (四)Thymeleaf标准表达式之——[3->6] 操作符(文本、算术、布尔、比较及相等)

    2.3 文本操作符 模板名称:text.html 连接符: +   可以是任意字符和表达式等 文本替换符:|    不能表达出条件表达式(官网:只能是变量表达式) e.g. 1.<span th ...

  2. [linux]iostat命令详解-监视系统输入输出设备和CPU的使用情况

    部分转载https://blog.csdn.net/sunansheng/article/details/51942281 iostat命令被用于监视系统输入输出设备和CPU的使用情况.它的特点是汇报 ...

  3. 合并apk和odex

    Android的ROM中有很多odex文件,相对于APK中的dex文件而言这个odex有什么作用呢? 如果你仔细观察会发现文件名时一一对应的,同时那些对应的apk文件中没有dex文件.这样做可以使其厂 ...

  4. 01-2制作U盘启动盘--装机助理工具

    在可以上网的电脑上执行制作启动盘的操作: 打开浏览器输入:http://www.zhuangjizhuli.com/upan.html 1.制作U盘启动盘: 2.下载 装机助理 软件 3.步骤: 第一 ...

  5. BNU 34990 Justice String (hash+二分求LCP)

    思路:枚举第一个字符串的位置,然后枚举最长公共前缀的长度,时间即会下降-- #pragma comment(linker, "/STACK:1024000000,1024000000&quo ...

  6. H5中滚动卡顿的问题

    加入-webkit-overflow-scrolling: touch;即可

  7. Android IntentService全然解析 当Service遇到Handler

    转载请标明出处: http://blog.csdn.net/lmj623565791/article/details/47143563: 本文出自:[张鸿洋的博客] 一 概述 大家都清楚.在Andro ...

  8. Oracle集群和灾备解决方案介绍

       Oracle本身有各种各样的解决方案,本文主要是对以下几种解决方案做一下简单的梳理. 1. Oracle Rac解决方案. Oracle Rac主要通过两台Oracle服务器来组件集群,提高Or ...

  9. PHP压缩上传图片

    最近手上的项目页面要显示很多图片,虽然用了jQuery的lazyload,但是效果并没理想,滑动到一个区域还要比较长的时间图片才完全显示出来.于是想着将上传上去的900KB+压缩备份一份缩略图. PH ...

  10. ngnix 参考配置

    #user nobody; worker_processes ; #error_log logs/error.log; #error_log logs/error.log notice; #error ...