【力扣】136. 只出现一次的数字

时间复杂度:\(O(n)\)
空间复杂度:\(O(1)\)

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

        return result;
    }
}
posted @ 2022-10-31 18:29  HypoPine  阅读(23)  评论(0)    收藏  举报