Skip to main content

Final — A: Grid Corridor

Challenge on lesson: Final-A: Grid Corridor

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** An n x m grid of digits (0-9). You start at the top-left cell and walk to the bottom-right, moving only right or down, collecting the digits along the way (including both ends). Print the maximum total collectible. **Input:** Line 1: n m (1 <= n, m <= 1000). Next n lines: m digits each. **Output:** One integer — the maximum total. **Example:** 2 2 / 19 / 28 -> 18 (1->9->8).

Back to lesson: Final-A: Grid Corridor