Step 1: Initialize a 3x3 grid with 1s in the first row and first column
[1, 1, 1]
[1, 0, 0]
[1, 0, 0]
Why: Only one way to reach cells in first row (all right moves) and first column (all down moves)
Step 2: Calculate paths for cell (1,1) by adding paths from top (0,1) and left (1,0)
[1, 1, 1]
[1, 2, 0]
[1, 0, 0]
Why: Paths to (1,1) = paths from above + paths from left = 1 + 1 = 2
Step 3: Calculate paths for cell (1,2) by adding paths from top (0,2) and left (1,1)
[1, 1, 1]
[1, 2, 3]
[1, 0, 0]
Why: Paths to (1,2) = 1 + 2 = 3
Step 4: Calculate paths for cell (2,1) by adding paths from top (1,1) and left (2,0)
[1, 1, 1]
[1, 2, 3]
[1, 3, 0]
Why: Paths to (2,1) = 2 + 1 = 3
Step 5: Calculate paths for cell (2,2) by adding paths from top (1,2) and left (2,1)
[1, 1, 1]
[1, 2, 3]
[1, 3, 6]
Why: Paths to (2,2) = 3 + 3 = 6
Result: Final grid with path counts:
[1, 1, 1]
[1, 2, 3]
[1, 3, 6]
Number of unique paths = 6