LeetCode Problem 3235: Check if the Rectangle Corner Is Reachable You are given two…
- User
LeetCode Problem 3235: Check if the Rectangle Corner Is Reachable
You are given two positive integers
xCornerandyCorner, and a 2D arraycircles, wherecircles[i] = [x_i, y_i, r_i]denotes a circle with center at(x_i, y_i)and radiusr_i.There is a rectangle in the coordinate plane with its bottom left corner at the origin and top right corner at the coordinate
(xCorner, yCorner). You need to check whether there is a path from the bottom left corner to the top right corner such that the entire path lies inside the rectangle, does not touch or lie inside any circle, and touches the rectangle only at the two corners.pythonclass Solution: def canReachCorner(self, xCorner: int, yCorner: int, circles: List[List[int]]) -> bool:Return
trueif such a path exists, andfalseotherwise.Example 1: Input:
xCorner = 3,yCorner = 4,circles = [[2,1,1]]Output:trueExample 2: Input:
xCorner = 3,yCorner = 3,circles = [[1,1,2]]Output:falseExample 3: Input:
xCorner = 3,yCorner = 3,circles = [[2,1,1],[1,2,1]]Output:false - Assistant