Skip to content

Commit 5cd7d95

Browse files
authored
Update xor-operation-in-an-array.py
1 parent 820f3e7 commit 5cd7d95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/xor-operation-in-an-array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def xorNums(n, start):
1212
def xorNumsBeginEven(n, start):
1313
assert(start%2 == 0)
1414
# 2*i ^ (2*i+1) = 1
15-
return ((n//2)%2)^((start+n-1) if (n%2) else 0)
15+
return ((n//2)%2)^((start+n-1) if n%2 else 0)
1616

1717
return start^xorNumsBeginEven(n-1, start+1) if start%2 else xorNumsBeginEven(n, start)
1818

0 commit comments

Comments
 (0)