Skip to content

best [terminology]

Terminology

Usage

  • Use for an optimum found so far.
  • It implies repeated maximum or minimum comparisons.
  • Prefer it over ans when the algorithm explicitly tracks the best candidate.
  • Use a compound name such as best_l when multiple pieces describe the optimum.
best = nums[0]

for x in nums[1:]:
    best = max(best, cur_max)