Skip to content

Commit ed1861d

Browse files
committed
performance command
1 parent 05c7204 commit ed1861d

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

hackerrank/performance_command.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
N = int(input())
3+
i = 1
4+
data = []
5+
while i <= 12:
6+
a = input()
7+
d = a.split()
8+
if d[0] == "insert":
9+
data.insert(int(d[1]), int(d[2]))
10+
elif d[0] == "remove":
11+
data.remove(int(d[1]))
12+
elif d[0] == "append":
13+
data.append(int(d[1]))
14+
elif d[0] == "sort":
15+
data.sort()
16+
elif d[0] == "pop":
17+
data.pop()
18+
elif d[0] == "reverse":
19+
data.reverse()
20+
elif d[0] == "print":
21+
print(data)
22+
i += 1
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from itertools import permutations
2+
3+
s = input().split()
4+
S, k = s[0], int(s[1])
5+
6+
for p in sorted(permutations(S, k)):
7+
print("".join(p))

0 commit comments

Comments
 (0)