Open cjql opened 4 years ago
https://leetcode.com/problems/single-number
class Solution: def singleNumber(self, nums: List[int]) -> int: return reduce(operator.xor, nums)
88 ms | 16.4 MB | python3
class Solution: def singleNumber(self, nums: List[int]) -> int: res = 0 for num in nums: res ^= num return res
80 ms | 16.2 MB
https://leetcode.com/problems/single-number
C++
Java
Python
88 ms | 16.4 MB | python3
80 ms | 16.2 MB
C
C
JavaScript
Ruby
Swift
Go
Scala
Kotlin
Rust
PHP