mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-25 03:11:41 +08:00
13 lines
163 B
Go
13 lines
163 B
Go
package leetcode
|
|
|
|
func xorGame(nums []int) bool {
|
|
if len(nums)%2 == 0 {
|
|
return true
|
|
}
|
|
xor := 0
|
|
for _, num := range nums {
|
|
xor ^= num
|
|
}
|
|
return xor == 0
|
|
}
|