Algo - matrix Flashcards
1
Q
- Stamping the Grid
- given a matrix with 0 is empty, 1 is blocked
- given an infinite number of stamps of width and height
- check if can cover all empty with stamps
Notices: - stamp must stay within the grid
- stamps can be overlapped by other
- stamp cannot cover blocked cell
A
- prefixSums: to sum sub-matrix => know if can put a stamp at current cell or not. If yes, put a stamp there. Note: must check range of cornerRow, cornerCol
- prefixSumStamps: to sum sub-matrix of cell with stamps
- using prefixSumStamps to check each cell if has already been covered