mathematics

Off-by-one in the count

What goes wrong

Counts the intervals where the stem counts the endpoints, or the reverse.

Next time

Explicitly state whether boundaries are included—use (ba+1)(b - a + 1) for inclusive integer ranges—and list the edge cases (00, start, and end elements) by hand.

Questions that set this trap

9 published questions