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
- Sorting
- Lily's Homework
- Discussions
Lily's Homework
Lily's Homework
Sort by
recency
|
263 Discussions
|
Please Login in order to post a comment
This is my new solution in Java language.
This is my old solution in Java language. Unfortunately, it can only pass half of the cases due to exceed the time limitation.
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions , feel free to give a star :) )
I see a lot of people confused by this one. The trick is to not worry about the specific sorting method, you will never get the correct number of swaps with quicksort.
The second trick is to avoid reversing the SORTED list. You have to reverse the ORIGINAL data. C++20 implementation