Citadel OA | Inversions | Citadel Online Assessment Question

A subsequence is created by deleting zero or more elements from a list while maintaining the order. For example, the subsequences of [1,2,3] are [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3]. An inversion is a strictly decreasing subsequence of length 3. More formally, given an array p=p[n] an inversion in the array is any time some p[i]>p[j]>p[k] and i<j<k.

This is a companion discussion topic for the original entry at