136. 只出现一次的数字 - 力扣(LeetCode)

大佬图解

代码

python 复制代码
# encoding = utf-8
# 开发者:Alen
# 开发时间: 18:44 
# "Stay hungry,stay foolish."

class Solution(object):
    def singleNumber(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """

        res = 0 # n ^ 0 = n
        for n in nums:
            res = res ^ n
        return res

结果

解题步骤:https://www.bilibili.com/video/BV1AiXrBsEWd/?vd_source=15b4bc8968fa5203cc470cb68ff72c96

相关推荐
文丑颜不良啊1 小时前
LeetCode1481~1500题目解析
java·leetcode
文丑颜不良啊2 小时前
LeetCode1381~1400题目解析
java·leetcode
Tisfy5 小时前
LeetCode 3882.网格图中最小异或路径:动态规划
算法·leetcode·动态规划
A boy CDEF girl6 小时前
算法题专栏:优选算法
数据结构·算法·leetcode
驭渊的小故事13 小时前
LeetCode 算法题解:滑动窗口与数组合并的实战应用
算法·leetcode·职场和发展
文丑颜不良啊13 小时前
LeetCode1501~1520题目解析
java·leetcode
Navigator_Z14 小时前
LeetCode //C - 1311. Get Watched Videos by Your Friends
c语言·算法·leetcode
Pniubi15 小时前
力扣42接雨水(动态规划法)
算法·leetcode·职场和发展
Pniubi15 小时前
力扣46全排列(回溯(递归))
算法·leetcode·职场和发展
文丑颜不良啊16 小时前
LeetCode1461~1480题目解析
java·leetcode