Wrong Answer. Can't figure out Why

hello @rachitbansal2500
ur comparator is not correct.
u should sort on the basis of right most coordinate of the cirlce (something like activity selection problem).

https://ide.codingblocks.com/s/288832 Please check now?

@aman212yadav

hello @rachitbansal2500
image
here u should print n-maxx

1 Like

@aman212yadav but I am trying to count the valid circles by doing max++ only when the circle isn’t overlapping.

yeah u r counting number of non overlapping circles,but in problem they have asked to print number of circle that we remove to make other circle non overlaping.
thats why n-maxx.

1 Like

Oh ok ok. Thank youu :slight_smile:. You are a life saver.

Bro still wrong answer @aman212yadav

image
because here u r modifying ur n.

store it in some variable .and then use that variable in later section of ur code.

1 Like

ur updated code->

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.