We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Implementation
- Almost Sorted
- Discussions
Almost Sorted
Almost Sorted
Sort by
recency
|
491 Discussions
|
Please Login in order to post a comment
Java
List sorted = arr.stream().sorted().collect(Collectors.toList()); List swap=new ArrayList<>(arr);
Wouldn't the test case
9
10 15 14 13 10 6 16 20 30
Invalidate a lot of the correct answers here?
(Updated) O(n) solution without sorting
python
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions , feel free to give a star :) )