Step 1 / 4Initialize dp[0] = 0. Base case.
Step 2 / 4dp[1] = dp[0] + 7. Single arrow from cell 0 to cell 1.
Step 3 / 4dp[2]: from cell 0 cost +2, from cell 1 cost +5. Two arrows into same target.
Step 4 / 4Highlight optimal path: 0 -> 1 -> 2. Arrows recolored to path.