leetcode-Single Number

Given an array of integers, every element appears twice except for one. Find that single one.app

Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?element

 

能夠巧妙地運用XOR運算符,由於兩個相同的數字XOR以後會被消除影響,因此剩下的就是惟一存在的數字。it

相關文章
相關標籤/搜索