Count Inversions Leetcode Problem