Efficient count of j's which satisfy arr[j]<arr[i] && j>i && j<arr.length
I encountered a problem on Codesignal (it requires coins to unlock, it's countSmallerToTheRight problem in Interview Practice, Common Techniques Advanced section -- apparently not common enough.. I did 89 of the 110 problems available before hitting this brick wall)
Every solution I've thought of is n^2 and times out. Basically I need to calculate how many items to the right of each index in the array are a value less than the current value
Was hoping someone could point me in the right direction
Comments
Can you share the link to the problem statement?