Count Inversion Leetcode Problem 21