Binary Search interview questions
Practice 3 questions on binary search. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
3 questions
- EASY
First Bad Version
Find the first failing version among 1..n where a monotonic isBad check flips from false to true — a boundary binary search using the fewest checks.
15 minAlgorithms - MEDIUM
Integer Square Root
Compute the integer square root — the floor of the real square root — using Newton's method, without Math.sqrt.
25 minAlgorithms - HARD
Median of Two Sorted Arrays
PREMIUMFind the median of two sorted arrays in logarithmic time by binary-searching for the partition that splits all the elements into equal halves.
40 minAlgorithms