1. 审题
Given an array of integers, every element appears three times except for one, which appears exactly once. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
原题链接:https://leetcode.com/problems/single-number-ii/description/
这道题的难点在于,复杂度要求O(n),且不能开辟额外空间。
可以用位运算的思路来解题。
2. 解题及代码分析
https://leetcode.com/problems/single-number-ii/discuss/ 这里面提到的解题思路较优ÿ