解题思路:
转自题目后面讨论区 用两个数字来维护

提交代码:维护map

class Solution {
    public int singleNumber(int[] nums) {
    	int x1=0,x2=0;
    	for(int num : nums) {
    		x1=(x1^num)&~x2;
    		x2=(x2^num)&~x1;
    	}
    	return x1;
    }
}

运行结果:
【leetcode】137.(Medium)Single Number II

相关文章:

  • 2022-12-23
  • 2021-09-20
  • 2021-11-22
  • 2021-10-14
  • 2022-03-04
  • 2022-02-12
猜你喜欢
  • 2021-06-30
  • 2022-02-22
  • 2022-02-10
  • 2021-11-29
  • 2021-08-13
  • 2021-08-12
相关资源
相似解决方案