Solution: Inversion Count in a List
This lesson explains how to calculate inversion count in a divide and conquer paradigm.
We'll cover the following
Solution: 1
The naive solution to this problem would be to:
- Pick an element from the list
- Compare it with all elements to its right
- If the element on the right is smaller, increment the inversion count
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.