Back to exercises

Binary Search

Use left and right pointers, compute the middle index, and discard half the range each step based on the comparison.

Coding Exercises Easy O(log n)

Binary Search

Use left and right pointers, compute the middle index, and discard half the range each step based on the comparison.

Given a sorted list and a target, return the target index or -1 if it is missing.