1401. Circle and Rectangle Overlapping
Last updated
Last updated
https://leetcode.com/problems/circle-and-rectangle-overlapping
Given a circle represented as (radius
, x_center
, y_center
) and an axis-aligned rectangle represented as (x1
, y1
, x2
, y2
), where (x1
, y1
) are the coordinates of the bottom-left corner, and (x2
, y2
) are the coordinates of the top-right corner of the rectangle.
Return True if the circle and rectangle are overlapped otherwise return False.
In other words, check if there are any point (xi, yi) such that belongs to the circle and the rectangle at the same time.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
1 <= radius <= 2000
-10^4 <= x_center, y_center, x1, y1, x2, y2 <= 10^4
x1 < x2
y1 < y2