Overview
A matrix in data structures usually means a 2D array: a grid of values arranged in rows and columns.
Movements
| Action | Row | Column |
|---|---|---|
| Up | -1 | 0 |
| Down | +1 | 0 |
| Left | 0 | -1 |
| Right | 0 | +1 |
Example
Suppose we are atRow 2, Col 3 and want to move two steps up.
(-1, 0) twice: subtract 1 from the row two times while keeping the column the same.
Row 0, Col 3.