+ 2
Can anyone give shorter version of my code?
Here we are given a circle with radius and center and a axis aligned rectangle whose bottom left and top right coordinaates are given . We have to tell if they overlap Sample input: Radius xcenter ycenter X1 y1 x2 y2 ie. 1 0 0 1 -1 3 1 Output: true My code link is https://code.sololearn.com/cvjmzKzKEYpq/?ref=app
6 Antworten
0
What do you mean by axis aligned rectangle exactly?
0
Nishant Sharma it means it sides are parallel to the axes
I hope now you understand
0
may be, forming the circles's equation and substituting the values
0
Hima I have used same logic
Any another logic?
0
Then read about hypot function in python to shorten the code
0
Prince Yadav logic is same