Given an array of integers, every element appears twice except for one. Find that single one.
来源:互联网 发布:夏洛克妹妹欧洛丝 知乎 编辑:程序博客网 时间:2024/05/21 12:56
class Solution {public: int singleNumber(int A[], int n) { int n1 = 0; for(int i = 0;i<n;++i) { n1^=A[i]; } return n1; }};
相异为1;找到相等的部分;为1的部分是不同的·
0 0
- Given an array of integers, every element appears twice except for one. Find that single one.
- Given an array of integers, every element appears twice except for one. Find that single one.
- Given an array of integers, every element appears twice except for one. Find that single one.
- Given an array of integers, every element appears twice except for one. Find that single one.
- Given an array of size n, find the majority element. The majority element is the element that appear
- given an array of integers Find the index of values that satisfy A+B = C + D
- Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missi
- Find that single one.(linear runtime complexity0
- 【LeetCode】169. Majority Element Majority Element Given an array of size n, find the majority eleme
- Given an array of integers, return indices of the two numbers such that they add up to a specific ta
- CareerCup Given an array of (unsorted) integers, arrange them such that a < b > c < d > e... etc.
- 代码面试题:Find the first element in a given string A that also appears in another given string B
- Find the maxest element of an array
- Given an array of ages (integers) sorted lowest to highest, output the number of occurrences for eac
- Find the element that appears once
- Find the element that appears once
- CareerCup Given an array having positive integers, find a subarray which adds to a given number
- Given an array of integers, sort the array according to frequency of elements
- 【经典例题】高次幂的后几位数
- LeeCode 边界条件注意
- codeforces--2014/1/18--A. Ksenia and Pan Scales
- 教你怎么修改通讯录短信默认头像
- linux设置开机服务自动启动
- Given an array of integers, every element appears twice except for one. Find that single one.
- ahhfah,大上午的,烦人
- 用.htaccess实现301转向
- 如何通过预加载器提升网页加载速度
- Ipad Video Lessons
- Web版Telnet工具设计与实现
- vs2010卸载
- Linux 开启VNCSERVER
- QT中QImage类