Skip to content

Commit 4ec6971

Browse files
committed
2020-08-17
1 parent 8031e71 commit 4ec6971

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution(object):
2+
def xorOperation(self, n, start):
3+
"""
4+
:type n: int
5+
:type start: int
6+
:rtype: int
7+
"""
8+
res = start
9+
for i in range(1, n):
10+
res ^= start + 2 * i
11+
return res
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution(object):
2+
def restoreString(self, s, indices):
3+
"""
4+
:type s: str
5+
:type indices: List[int]
6+
:rtype: str
7+
"""
8+
res = ["" for _ in indices]
9+
for i in range(len(s)):
10+
res[indices[i]] = s[i]
11+
return "".join(ch for ch in res)

0 commit comments

Comments
 (0)