Off-by-one errors are real errors. A common mistake rookie developers make (or used to make, anyway) is forgetting that arrays are zero-indexed when creating an array, then seeing the value that should be in array[n-1] when they read array[n].
Another common off-by-one error is double counting: Some accumulators don’t do all their processing in the same function, and occasionally one thing will be checked for inclusion twice, causing the accumulator to have one more element than it should.
off by one is a margin not an error
Off-by-one errors are real errors. A common mistake rookie developers make (or used to make, anyway) is forgetting that arrays are zero-indexed when creating an array, then seeing the value that should be in
array[n-1]when they readarray[n].Another common off-by-one error is double counting: Some accumulators don’t do all their processing in the same function, and occasionally one thing will be checked for inclusion twice, causing the accumulator to have one more element than it should.
Tell that to the array out of bounds exception!