Files
LeetCode-Go/leetcode/0810.Chalkboard-XOR-Game/810. Chalkboard XOR Game.go
2021-05-22 22:40:52 +08:00

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
}