Tap here to switch tabs
Problem
Submissions

Problem: Circle and Rectangle Overlapping

med
30 min
Try to solve the Circle and Rectangle Overlapping problem.

Statement

You are given a circle defined by its radius radius and its center coordinates (xCenter, yCenter). You are also given an axis aligned rectangle defined by its bottom left corner (x1, y1) and its top right corner (x2, y2).

Return true if the circle and the rectangle share at least one point, or false otherwise.

Constraints:

  • 1≤1 \leq radius ≤2000\leq 2000

  • −104≤-10^4 \leq xCenter, yCenter ≤104\leq 10^4

  • −104≤-10^4 \leq x1 << x2 ≤104\leq 10^4

  • −104≤-10^4 \leq y1 << y2 ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Circle and Rectangle Overlapping

med
30 min
Try to solve the Circle and Rectangle Overlapping problem.

Statement

You are given a circle defined by its radius radius and its center coordinates (xCenter, yCenter). You are also given an axis aligned rectangle defined by its bottom left corner (x1, y1) and its top right corner (x2, y2).

Return true if the circle and the rectangle share at least one point, or false otherwise.

Constraints:

  • 1≤1 \leq radius ≤2000\leq 2000

  • −104≤-10^4 \leq xCenter, yCenter ≤104\leq 10^4

  • −104≤-10^4 \leq x1 << x2 ≤104\leq 10^4

  • −104≤-10^4 \leq y1 << y2 ≤104\leq 10^4