Skip to content

top / bottom / left / right [terminology]

Terminology

Usage

  • Use full directional names when maintaining all four boundaries of a rectangular region.
  • Full names prevent ambiguity between row boundaries and column boundaries.
  • Prefer these names over t, b, l, and r in spiral and layer-based matrix traversal.
top, bottom = 0, len(matrix) - 1
left, right = 0, len(matrix[0]) - 1