Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use an ordered set for maintaining the occurrences of each ID.
After step <code>i</code> find the occurrences of <code>nums[i]</code>.
Change the occurrences of <code>nums[i]</code> in the ordered set.