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. 代理工具Charles使用

    代理工具Charles使用 分类: MAC 2014-03-27 20:41 7810人阅读 评论(2) 收藏 举报 手机开发 一.跟踪HTTPS 1.下载官方的证书ssl.zip证书,解压成*.cr ...

  2. apk文件反编译

    apk文件的反编译,需要的工具apktool(反编译资源文件)和dex2jar-0.0.7.9-SNAPSHOT(反编译源码) 1.  下载相关软件 1)Apktool,下载地址:http://cod ...

  3. smarty、smarty格式化、smarty整数、smarty float、smarty各种转换方式、smarty日期转换等等 (转)

    <? require("setup.php"); define('PAGETITLE','pagtitle'); function insert_top($lid,$sid) ...

  4. PATHINFO模式是thinkphp特有的吗?

    pathinfo当然不是某个框架特有的,pathinfo严格上讲是HTTP服务器提供的一个预定义变量,在许多的框架中有一个重要的组件叫做路由器,这个组件可以通过使用pathinfo来实现. 考虑以下代 ...

  5. 微信公众号开发之创建菜单栏代码示例(php)

    思路很简单:就是先获取access_token,然后带着一定规则的json数据参数请求创建菜单的接口.废话不多讲,直接上代码. class Wechat { public $APPID="w ...

  6. VM虚拟机内ubuntu无法连接到网络

    VM虚拟机内ubuntu无法连接到网络 解决:编辑网络,将网路都删除掉.又一次加入网络桥接和NAT链接. .又一次连接就可以,查看一下ip地址. 方法2: 虚拟机中新装ubuntu 编辑虚拟网络,先恢 ...

  7. PHP高级工程师的要求

    PHP 高级工程师1名,(3年以上工作经验  )   1.熟悉unix环境编程,如多线程/多进程,IO复用.锁.定时器.新号.信号量.共享内存.消息队列.文件系统2.熟悉php的stream.sock ...

  8. springboot 中使用AOP

    网上关于AOP的例子好多,各种名词解释也一大堆,反正名词各种晦涩,自己写个最最最简单的例子入门mark一下,以后再深入学习. maven依赖 <dependency> <groupI ...

  9. Swing与javafx直接调用

    Swing调用javafx 调用方法: Platform.runLater(new Runnable(){ @Override public void run() { WebView webView ...

  10. Live555 中的客户端动态库.so的调用方式之一 程序中调用

    1.  打开动态链接库:    #include <dlfcn.h>    void *dlopen(const char *filename, int flag);    该函数返回操作 ...