board of zeros and ones. You may rearrange its columns in any order (each column moves as a whole; rows stay in place).
After rearranging, look for a rectangular block of adjacent cells made entirely of ones. Return the largest area such a block can have under the best column order. If there are no ones, the answer is 0.board=[[1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 1]] → 6
Columns 0 and 3 are all ones. Put them side by side to get a 3×2 block with area 6.
board=[[0, 1, 0, 1, 1]] → 3
The three ones can be gathered side by side: a 1×3 block.
board=[[1, 0], [0, 1]] → 1
However the columns are ordered, the ones sit in different rows, so the best block is a single cell.
board=[[1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 1]]
6
Run checks the first 3 tests in your browser. Submit checks all 86 tests on the server, hidden ones included.