Inversion count

Does this code work when there are duplicates in the array??

I have written the code for a similar question on leetcode but it does not work…can someone help?

this is the question link

hi @aryamaan1011,


I have commented your mistakes .
If you have any other doubt please let me know.

Hey can u plz explain what was wrong in the code i had written?

And btw this code would give TLE when submitted on leetcode

It needs more optimization