We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fd9b81 commit d9c6b54Copy full SHA for d9c6b54
Python/bigsort.py
@@ -0,0 +1,29 @@
1
+#!/bin/python3
2
+
3
+# This is the solution for problem mentioned in
4
+# https://www.hackerrank.com/challenges/big-sorting/problem
5
+import os
6
7
+if __name__ == '__main__':
8
+ unsorted = []
9
10
+ n = int(input())
11
+ for _ in range(n):
12
+ unsorted.append(input())
13
14
+ # 1st try
15
+ # unsorted.sort(key=lambda x: int(x))
16
17
+ # 2nd try
18
+ # unsorted.sort(key=int)
19
20
+ # 3rd try
21
+ # unsorted = sorted(unsorted, key=int)
22
23
+ # 4th try
24
+ unsorted.sort() # Sort according to ASCII value
25
+ unsorted.sort(key=len) # Sort according to len
26
27
+ with open(os.environ['OUTPUT_PATH'], 'w') as fptr:
28
+ fptr.write('\n'.join(unsorted))
29
+ fptr.write('\n')
0 commit comments