height tall and width wide. It is cut all the way through: row_cuts[i] is the distance from the top edge to the i-th horizontal cut, and col_cuts[j] is the distance from the left edge to the j-th vertical cut. The cuts are listed in no particular order.
After all the cuts, the sheet falls apart into rectangular pieces. Return the area of the largest piece modulo 10⁹ + 7.height=6, width=5, row_cuts=[2, 5], col_cuts=[3] → 9
Along the height the strips are 2, 3 and 1; along the width, 3 and 2. The largest piece is 3 × 3 = 9.
height=4, width=7, row_cuts=[1], col_cuts=[6, 2] → 12
Cuts may come in any order. Strips along the height are 1 and 3, along the width 2, 4 and 1: 3 × 4 = 12.
height=2, width=2, row_cuts=[1], col_cuts=[1] → 1
row_cuts are distinct, and so are those in col_cutsheight=6, width=5, row_cuts=[2, 5], col_cuts=[3]
9
Run checks the first 3 tests in your browser. Submit checks all 88 tests on the server, hidden ones included.