-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefuse_bomb.py
More file actions
34 lines (34 loc) · 948 Bytes
/
Copy pathdefuse_bomb.py
File metadata and controls
34 lines (34 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class Solution:
def decrypt(self, code: List[int], k: int) -> List[int]:
x = [0]*len(code)
c = 0
if k > 0:
while c < len(code):
temp = k
s = c+1
while temp != 0:
print(s)
if s >= len(code):
s = 0
x[c] += code[s]
s += 1
temp -= 1
c += 1
return x
elif k < 0:
k = abs(k)
code = code[::-1]
while c < len(code):
temp = k
s = c+1
while temp != 0:
print(s)
if s >= len(code):
s = 0
x[c] += code[s]
s += 1
temp -= 1
c += 1
return x[::-1]
else:
return x