mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-23 18:10:20 +08:00
10 lines
134 B
Go
10 lines
134 B
Go
package leetcode
|
|
|
|
func xorOperation(n int, start int) int {
|
|
res := 0
|
|
for i := 0; i < n; i++ {
|
|
res ^= start + 2*i
|
|
}
|
|
return res
|
|
}
|