Leetcode 1610 Solution
This article provides solution to leetcode question 1610 (xor-operation-in-an-array)
Access this page by simply typing in "lcs 1610" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/xor-operation-in-an-array
Solution
class Solution:
def xorOperation(self, n: int, start: int) -> int:
ans = 0
for i in range(n):
ans ^= start + 2 * i
return ans