137. Single Number II

2016-12-07  本文已影响0人  我是你的果果呀

Given an array of integers, every element appearsthreetimes except for one. Find that single one.

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

这题理解起来比single number 3 简单些。 没个数都出现三次, 只有一个粗线一次。那找到每个位上的1 的值%3 != 0 就是这个值。32个位挨个找一遍。

上一篇 下一篇

猜你喜欢

热点阅读