TryBugHunt
All collections
📏Pattern Mastery ~25 mins

The Off-By-One Gauntlet

Conquer the most universal bug in computing

Fencepost errors, inclusive vs exclusive slice bounds, and loops that step one position too far.

Mixed (Python & JS)Medium5 Challenges

Your Progress

0 of 5 completed

Start Collection

Challenges in this collection

  1. 1

    Sum from 1 to n leaves out n

    sum_range(n) adds up every whole number from 1 to n. Example: sum_range(5) → 15 (1 + 2 + 3 + 4 + 5).

    easy
  2. 2

    First 3 items comes back with only 2

    firstChunk(arr, size) returns the first size items of the array. Example: firstChunk([1, 2, 3, 4, 5], 3) → [1, 2, 3].

    easy
  3. 3

    Last letter crashes with IndexError

    last_char(text) returns the last character. Example: last_char("hello") → "o".

    easy
  4. 4

    Adding up [1, 2, 3] gives NaN

    sumAll(nums) adds up every number in the array. Example: sumAll([1, 2, 3]) → 6.

    easy
  5. 5

    Shopping total crashes at the end of the list

    cart_total(prices) adds up every price. Example: cart_total([10, 20, 30]) → 60.

    easy

More collections to explore