Wish interview question

Count inversions and print the process