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.
I came up with a similar but not exactly the same approach in which i just counted mismatches and thought to apply some function on mismatches that would directly give swaps:
Lily's Homework
You are viewing a single comment's thread. Return to all comments →
I came up with a similar but not exactly the same approach in which i just counted mismatches and thought to apply some function on mismatches that would directly give swaps:
But it somehow fails test case 1, 2, 3, 6. In the end I decided to go with actually swapping and counting it
Isn't there any such function that could direcly be applied on mismatch count to yield number of swaps?