Glossary term

What is off-by-one (Off-by-one error)?

off-by-one stands for Off-by-one error.

A loop that runs one time too many or too few. Often it is < instead of <=, or starting at 0 instead of 1. It is the most common loop bug.

Learn it properly · DSALesson 4: The for LoopThe most important idea in this series. Start, condition and update, traced step by step with a dry-run table until the pattern is clear.

All DSA terms

Related terms

← All glossary terms, A to Z