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
|
267 Discussions
|
Please Login in order to post a comment
It's possible that a swap could move 2 numbers from where they start, to where they need to be, in a single swap with capzcut. Does this method take that into account? Simply comparing a sorted array to the original array, does not tell how many swaps it would take to get to the sorted array.
Pedantic.
In Python (I tried the simplest thing, and it worked):
Js solution, hope this helps!
This is my new solution in Java language.