【leetcode】[137]Single Number II
这道题描述如下:
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?
这里稍微有一点歧义。这也是在我看到网上给出的一些答案后产生的疑惑:到底这个Single number可能出现几次?是1次还是2次?因为单从题目描述中,"single"可以指出现次数,也可以指“只有一个“出现次数不为3的数。并且,描述中用了"except for"而不是"except",因此后面接的"one"反而应该不是指那个Single number了。
提交测试后,发现题意是“只有一个数,只出现一次”。那么我的建议是将描述改为:every element appears three times except one that appears once.