美文网首页
137. Single Number II

137. Single Number II

作者: 我是你的果果呀 | 来源:发表于2016-12-07 03:19 被阅读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个位挨个找一遍。

相关文章

网友评论

      本文标题:137. Single Number II

      本文链接:https://www.haomeiwen.com/subject/wpkdmttx.html