
1
2
3
4
5
6
7
|
class Solution:
def xorOperation(self, n: int, start: int) -> int:
tmp=[start+2*i for i in range(n) ]
ans=tmp[0]
for i in range(1,len(tmp)):
ans=ans^tmp[i]
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
백준 3029 경고 (0) | 2021.07.16 |
---|---|
Leetcode 1913. Maximum Product Difference Between Two Pairs (0) | 2021.07.16 |
Leetcode 1791. Find Center of Star Graph (0) | 2021.07.16 |
Leetcode 1221. Split a String in Balanced Strings (0) | 2021.07.16 |
Leetcode 1773. Count Items Matching a Rule (0) | 2021.07.16 |
댓글