size × size with the origin in the bottom-left corner. Rectangular tiles lie on it: tiles[i] = [x1, y1, x2, y2], where (x1, y1) is the tile's bottom-left corner and (x2, y2) its top-right corner. Tiles never overlap, though they may touch along edges.
You may make two cuts across the whole field, either both horizontal or both vertical. The cuts split the field into three strips, and the following must hold:
- no tile is cut: each one lies entirely within a single strip;
- each of the three strips contains at least one tile.
Return True if such cuts exist, and False otherwise.size=6, tiles=[[0, 0, 2, 3], [2, 1, 4, 6], [4, 0, 6, 2], [4, 3, 6, 5]] → True
Vertical cuts at x = 2 and x = 4 give three strips: the first holds [0, 0, 2, 3], the second [2, 1, 4, 6], the third the remaining two tiles.
size=4, tiles=[[0, 0, 2, 2], [2, 0, 4, 2], [0, 2, 2, 4], [2, 2, 4, 4]] → False
This is a 2×2 grid of tiles: on either axis they form only two strips, never three.
size=5, tiles=[[0, 0, 5, 1], [1, 1, 3, 3], [0, 3, 2, 5], [3, 4, 5, 5]] → True
size=6, tiles=[[0, 0, 2, 3], [2, 1, 4, 6], [4, 0, 6, 2], [4, 3, 6, 5]]
True
Run checks the first 3 tests in your browser. Submit checks all 51 tests on the server, hidden ones included.