Practice ยท 3 of 3
Bisect Simulator
bisect(commits, isBad) โ commits is an ordered array of ids oldest-first; isBad(id) returns a boolean. Simulate binary search: probe the middle, discard the half that cannot contain the FIRST bad commit, repeat. Return the id of the first bad commit (probe count must not exceed ceil(log2(n)) + 2 โ efficiency matters).
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: History as Data โ Practice