[x, y] with 0 ≤ x, y < 10⁶. Some cells hold walls, listed in walls.
A robot stands on cell start and wants to get to cell finish. In one move it steps to a cell sharing a side with its current one, provided that cell is not a wall and is still inside the field.
Return True if the robot can reach finish, and False otherwise.
The field is far too large to explore in full: think about how many cells a mere 200 walls can possibly shut in.walls=[[1, 0], [1, 1], [0, 2]], start=[0, 0], finish=[5, 5] → False
The walls (1, 0), (1, 1), (0, 2) together with the edge of the field lock in the cells (0, 0) and (0, 1), so there is no way out of that corner.
walls=[[3, 3], [3, 4], [4, 3]], start=[2, 2], finish=[4, 4] → True
The walls cover finish from two sides only: you can reach (4, 4) through (5, 4) or (4, 5).
walls=[], start=[999999, 0], finish=[0, 999999] → True
There are no walls, so every cell can be reached.
walls) ≤ 200walls[i] = [x, y], 0 ≤ x, y < 10⁶start and finish are pairs [x, y], 0 ≤ x, y < 10⁶start ≠ finishstart nor finish is a wallwalls=[[1, 0], [1, 1], [0, 2]], start=[0, 0], finish=[5, 5]
False
Run checks the first 3 tests in your browser. Submit checks all 106 tests on the server, hidden ones included.