all the circles with center at (1,0) are 1 unit apart from it’s adjacent circle,therefore no circle is overlapping. Thus ,we don’t need to remove any circle
Couldn't understand the question
@tanjuljain19
The circle should not touch any other circle. The circles are at (1,0) , (2,0) , (3,0) , (4,0) of radius 1.
https://ide.codingblocks.com/s/229406 2 test cases going wrong. I have applied an approach similar to activity selection
https://ide.codingblocks.com/s/229406 2 test cases going wrong. I have applied an approach similar to activity selection
@tanjuljain19 the problem is with the abs(c+r) you are doing, since |c|<=10^9 so it can be negative and hence c+r can be negative, so just dont take abs.
Do this change, otherwise your code is correct.
Also please remember to mark this doubt as resolved after submitting it.
Thanks a lot for your help
1 Like