grid of size n × n lies on a table: each cell is either cut out (1) or solid (0). There is also a pattern goal of the same size.
You may turn the tile on the table by 90° as many times as you like (flipping it over is not allowed). Return True if some number of turns (possibly zero) makes the tile match the pattern cell for cell, and False otherwise.grid=[[1, 1], [0, 0]], goal=[[0, 1], [0, 1]] → True
A 90° clockwise turn moves the top row into the right column, which gives goal.
grid=[[1, 0], [0, 0]], goal=[[0, 1], [1, 0]] → False
grid has a single 1 while goal has two, so no turn can fix that.
grid=[[0, 0, 1], [0, 1, 0], [0, 0, 0]], goal=[[0, 0, 0], [0, 1, 0], [1, 0, 0]] → True
A 180° turn moves the corner cell from the top right to the bottom left.
grid and goal are both n × ngrid=[[1, 1], [0, 0]], goal=[[0, 1], [0, 1]]
True
Run checks the first 3 tests in your browser. Submit checks all 82 tests on the server, hidden ones included.