← switch

136. Single Number

easy

Array · Bit Manipulation

read the problem on leetcode →

first solved 25 Mar 2024

python
class Solution:
    def singleNumber(self, nums: List[int]) -> int:
        dict={}
        for i in nums:
            if i not in dict:
                dict[i]=nums.count(i)
        for i,j in dict.items():
            if j==1:
                return i
            
        
Single Number · switch