题目:
Given an array of integers, every element appears three times except
for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you
implement it without using extra memory?
思路:
一个比较好的方法是从位运算来考虑。每一位是0或1,由于除了一个数其他数都出现三次,我们可以检测出每一位出现三次的位运算结果再加上最后一位即可。
LeetCode | Single Number II【转】,布布扣,bubuko.com
LeetCode | Single Number II【转】
原文:http://www.cnblogs.com/linyx/p/3630478.html