본문 바로가기
python-algorithm

Leetcode 1486. XOR Operation in an Array

by 무적김두칠 2021. 7. 16.

1
2
3
4
5
6
7
class Solution:
    def xorOperation(self, n: int, start: int-> int:
        tmp=[start+2*for i in range(n) ]
        ans=tmp[0]
        for i in range(1,len(tmp)):
            ans=ans^tmp[i]
        return ans
cs
반응형

댓글