Efficient count of j's which satisfy arr[j]<arr[i] && j>i && j<arr.length

1 posts Thu, Apr 22, 2021 at 05:29 PM in Skill Building for Algorithm

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

View: Threaded  |  Flat
+0

Comments

  • hmehtahmehta Re: Efficient count of j's which satisfy arr[j]<arr[i] && j>i && j<arr.length (response to post by god_shiva)
    198 posts Thu, Apr 29, 2021 at 06:27 AM

    Can you share the link to the problem statement?

    +2
Sign In or Register to comment.