Skip to content

val [terminology]

Terminology

Usage

  • Use for a value extracted, stored, parsed, or associated with a node or key.
  • Prefer it over x when emphasizing that the variable holds a particular stored value.
while r < n and c >= 0:
    val = matrix[r][c]
    if val == target:
        return True
    if val > target:
        c -= 1
    else:
        r += 1

See 240. Search a 2D Matrix II.