This problem teaches you 2D array traversal. Nested loops give you access to every cell in a grid.
Manhattan distance is a common metric for grid problems. When you can only move horizontally or vertically, the shortest path length is the sum of absolute differences in coordinates.
This appears in pathfinding, puzzle games, and optimization problems. Understanding 2D indexing prepares you for pointer arithmetic in multiple dimensions. In memory, a 2D array is just a 1D block where matrix[i][j] translates to an offset.
This mental model connects array access to memory addresses.