Does a path exist? Reach (x2, y2) from (x1, y1) using moves (x+y, y), (x, x+y), (x+c, y+c) without stepping on cells where x+y is a perfect square.
Asked in the Online assessment stage. The problem was shown as images; the poster summarized the function as canReach(c, x1, y1, x2, y2).
Implement canReach(c, x1, y1, x2, y2) and return a boolean. Coordinates and c are positive integers. A move may not exceed (x2, y2), and both the starting and target cells are forbidden when their coordinate sums are perfect squares.
def canReach(c, x1, y1, x2, y2):