Wrong answer in 0st and 1st test case

Question:
https://online.codingblocks.com/app/player/67747/content/107303/5014/code-challenge

My code:

I am passing all test cases including the given example but TestCase 0 and TestCase 1. I have explained my approach in the code.

hello @Abhishek.1514
the issue is in ur comparator.

ur should sort on the basis of right end of the cirlce (i,e c + r).

sorting on the basis of only centre /radius will fail.

for example (1,5) (2,1) here circle one should come after circle 2.
but ur code will order them as (1,5) then (2,1)

https://ide.codingblocks.com/s/293056 I modi

https://ide.codingblocks.com/s/293056 I modified my code as suggested works fine in the example and passes the previous test cases where it didn’t but now problems occur in 4th and 5th test case. 4th test case TLE and 5th test case Run error


use < and then try

It worked but can you explain how it solved run error and TLE

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.