247086 Why is this code not working?


Why is this code not working?

@cbcao263,
You need to sort on the basis of radius of circles, and then count how many, you can keep.

In Hint Videos, Sir told that it is totally like Activity Selection Problem and we can sort that according to the end time and I think that’s really the good approach for that.

@cbcao263,
Sorting on the basis of radius, is exactly equivalent to sorting on the basis of end time, but you are sorting on the basis of c+r , which does not makes any sense.

But How can I sort on the basis of Radius?


In this way, Please correct this one.

@cbcao263,
I am sorry, your previous logic was also correct, there was just one mistake, you res counts maximum circles you can keep, thus the final answer should be n-res.

Ok Sir but When I submit, 1 Test Case is still not being passed. Can you please help for that.

@cbcao263,
if(v[i].first>=fin)

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.