Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Can you think of a DP solution?
Let DP[i][j] denote the minimum number of white tiles still visible from indices i to floor.length-1 after covering with at most j carpets.
The transition will be whether to put down the carpet at position i (if possible), or not.