Step 1: Initialize first row with 1s because only one way to move right along top row
[1, 1, 1]
[0, 0, 0]
[0, 0, 0]
Why: Only one path to each cell in first row by moving right
Step 2: Initialize first column with 1s because only one way to move down along left column
[1, 1, 1]
[1, 0, 0]
[1, 0, 0]
Why: Only one path to each cell in first column by moving down
Step 3: 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
Step 4: 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) = paths from above + paths from left
Step 5: 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) = paths from above + paths from left
Step 6: 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) = paths from above + paths from left
Result: Final DP grid:
[1, 1, 1]
[1, 2, 3]
[1, 3, 6]
Total unique paths = 6