Anyone have a good approach on solving these types of problems? DP problems like these are the only ones where I just can't figure out how to move on. I try to see if I can create subproblems, but it's not obvious to me

K Inverse Pairs Array

K Inverse Pairs Array