class Solution {
    public int singleNumber(int[] nums) {
        int result = 0;
    for(int i : nums) {
        result ^= i;
    }
    return result;

    }
}

思路:异或运算

136. 只出现一次的数字

相关文章:

  • 2021-05-08
  • 2021-11-28
  • 2021-11-14
  • 2021-09-24
  • 2022-02-28
  • 2021-08-22
  • 2021-11-06
  • 2021-12-22
猜你喜欢
  • 2021-07-11
  • 2021-04-21
  • 2021-04-06
相关资源
相似解决方案