Описание тега off-by-one

A class of errors commonly made by programmers characterized by accessing arrays at an index, whose value is greater or lesser than the intended value by 1

An off-by-one error (OBOE) is a logic error involving the discrete equivalent of a boundary condition. It often occurs in computer programming when an iterative loop iterates one time too many or too few. Usually this problem arises when a programmer fails to take into account that a sequence starts at zero rather than one (as with array indices in many languages), or makes mistakes such as using "is less than or equal to" where "is less than" should have been used in a comparison. This can also occur in a mathematical context.

[ source]