Module 2 · Binary Search · Binary Search Introduction

First bad version

Versions go good, good, …, bad, bad. Binary search finds where they switch: a Range keeps the first bad version between start and end, and every isBadVersion call throws away half of what's left.

In the numbered examples versions runs from 1 to n, with the version number under each box.

Search