#3225
Maximum Score From Grid Operations
international master · 2060 · lc hard +32 · 27% accepted · 82 likes · top 5%
Description
You are given n x n matrix grid (all cells start white). An operation chooses cell (i, j) and colors column j rows 0 through i black. The score is the total value of white cells having at least one horizontally adjacent black cell.
Return the maximum achievable score.
Code
1
2
3