题解 | #出现一次的数字#

出现一次的数字

http://www.nowcoder.com/practice/0bc646909e474ac5b031ec6836a47768

class Solution:
    def singleNumber(self , A ):
        # write code here
        res = 0
        for a in A:
            res ^= a
        return res
      
# 解释:
# 任何数^0=这个数
# 两个相同的数^=0
全部评论

相关推荐

评论
1
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务