(self, nums: List[int])
| 1 | class Solution: |
| 2 | def singleNumber(self, nums: List[int]) -> int: |
| 3 | dict1 = {} # Create hashtable |
| 4 | # Add counts into the hashtable |
| 5 | for x in nums: |
| 6 | if x not in dict1: |
| 7 | dict1[x] = 1 |
| 8 | else: |
| 9 | dict1[x] += 1 |
| 10 | # Select the single element |
| 11 | for ans, y in dict1.items(): |
| 12 | if y == 1: |
| 13 | return ans |
| 14 | |
| 15 | # Or bitwise way |
| 16 | class Solution: |
nothing calls this directly
no outgoing calls
no test coverage detected