Skip to content

Commit 7579800

Browse files
committed
issue #27 BigSorting -ing
1 parent 29738d4 commit 7579800

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/hackerrank/BigSorting.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package hackerrank;
2+
3+
import java.util.Arrays;
4+
5+
public class BigSorting {
6+
static String[] bigSorting(String[] unsorted) {
7+
long[] arr = new long[unsorted.length];
8+
9+
for(int i = 0; i<unsorted.length; i++){
10+
arr[i] = Long.parseLong(unsorted[i]);
11+
}
12+
Arrays.sort(arr);
13+
14+
for(int i=0; i<arr.length; i++){
15+
unsorted[i] = Object.toString(arr[i]);
16+
}
17+
return unsorted;
18+
}
19+
20+
public static void main(String[] args) {
21+
System.out.println(bigSorting(new String[]{"1", "200", "150", "3"}) + ", ans: [1 3 150 200]");
22+
}
23+
}

0 commit comments

Comments
 (0)