Skip to main content

Practice · 3 of 4

Binary search

CHALLENGE
Difficulty: beginner+25 XP

Implement binarySearch(int[] sorted, int target): return the index of target (the array IS sorted ascending), or -1 if absent. Halve the range each step — do not scan.

Back to lesson: Practice: Algorithmic reasoning reps