Leetcode 1610 Solution

This article provides solution to leetcode question 1610 (xor-operation-in-an-array)

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