LeetCodeDiary

A Diary for solving LeetCode problems

View on GitHub
class Solution:
    def xorOperation(self, n: int, start: int) -> int:
        res = start
        for i in range(1,n):
            res ^= (start + 2*i)
        return res

位运算 数组 简单 每日一题

https://leetcode-cn.com/problems/xor-operation-in-an-array/