Blind 75 Matrix Questions
3 problems · Free practice
Matrix questions combine row and column indexing with rules about when cells can change. Traversal problems require careful shrinking boundaries. In-place transformation problems require preserving information until it is no longer needed, sometimes by storing markers inside the matrix itself.
Practice matrices
Rotate Image
MediumRotate a square matrix 90 degrees clockwise in place. Do not allocate another matrix.
Spiral Matrix
MediumReturn the values of a rectangular matrix in clockwise spiral order, starting at the top-left.
Set Matrix Zeroes
MediumIf any entry in a rectangular matrix is zero, make its entire row and column zero. Perform the update in place using constant auxiliary space.
What to focus on
- Name row and column dimensions separately, even when an example is square.
- After shrinking a boundary, check whether another row or column still remains.
- For in-place marking, preserve the original status of any row or column used as storage.