2023-09-22 08:23:55 +0000 UTC
XOR Operation in an Array
Categories:
Links
Code
class Solution:
def xorOperation(self, n: int, start: int) -> int:
return reduce(lambda total, i: total ^ (start + 2 * i), chain((0, ), range(n)))
class Solution:
def xorOperation(self, n: int, start: int) -> int:
return reduce(lambda total, i: total ^ (start + 2 * i), chain((0, ), range(n)))