mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
10 lines
141 B
Go
10 lines
141 B
Go
package leetcode
|
|
|
|
func singleNumber(nums []int) int {
|
|
result := 0
|
|
for i := 0; i < len(nums); i++ {
|
|
result ^= nums[i]
|
|
}
|
|
return result
|
|
}
|