Count inversions in an array efficiently | Akuna Capital Interview Question