If you zero the second row immediately, what happens at the newly written zero in column 2?
1 / 9
Preserve only needed facts
A copied board is a simple correct model.
For zero propagation, row and column flags summarize the necessary original facts.
Could those same summaries drive Game of Life?
2 / 9
Valid Sudoku — predict before coding
Validation is three simultaneous uniqueness checks. A board can satisfy these checks without being solvable; this function does not search for a completion.
Decision: Cells (0,0) and (1,1) both contain 7; all other cells are empty. Which rule fails?
3 / 9
Spiral Matrix — predict before coding
The unvisited cells remain a rectangle. Boundary variables describe that rectangle, not the original matrix after some edges have already been consumed.
Decision: What is the spiral order of [[1,2,3],[4,5,6]]?
4 / 9
Rotate Image — predict before coding
Compose two easy coordinate transformations instead of memorizing a four-way cycle. A clockwise rotation maps original (r,c) to (c,n-1-r).
Decision: In a 3-by-3 matrix, where does the original cell (2,0) move after a clockwise rotation?
5 / 9
Set Matrix Zeroes — predict before coding
The first row and column become metadata storage. Their original zero status must be saved before the algorithm writes its own markers.
Decision: Why can matrix[0][0] alone not describe both the original first-row and first-column zero conditions?
6 / 9
Game of Life — predict before coding
This is a synchronous update. Two bits in each cell let old state and next state coexist until every next-state decision is complete.
Decision: For the 3-by-3 board with only the middle row live, what is the next board?
7 / 9
Diagonal Traverse — predict before coding
The sum r+c identifies a diagonal. Its parity determines traversal direction, separating geometry from boundary special cases.
Decision: What diagonal order comes from [[1,2,3],[4,5,6]]?
8 / 9
Reconstruct and transfer
Derive clockwise rotation from coordinates.
Explain the two first-axis flags.
Show why life updates need old and next state simultaneously.
9 / 9
←/→ or click edges to navigate · ? help · N notes · F fullscreen