leetcode —— single number
2014-09-11 13:47
211 查看
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
class Solution { public: int singleNumber(int A[], int n) { int number=A[0]; for (int i=1;i<n;++i) { number=number^A[i]; } return number; } };
相关文章推荐
- leetcode: (136) Single Number
- 【leetcode】Single Number 1 & 2
- leetcode-136-Single Number
- lintcode/leetcode由易至难第14题:Single Number
- LeetCode 136 Single Number
- LeetCode——Single Number
- LeetCode 136. Single Number
- leetcode || 136、Single Number
- 【leetcode】136. Single Number【java】使用异或
- leetcode136~Single Number
- LeetCode——Single Number
- LeetCode Single Number
- leetcode-Single Number
- ( leetcode ) Single Number
- LeetCode 找出 单独的数 Single Number
- 【C++】【LeetCode】136. Single Number
- leetcode--Single Number
- [Leetcode]Single Number
- leetcode - Single Number
- LeetCode练习一:Single Number