51 Binary search template Easy Binary Search

Look for a specific number in a sorted list by repeatedly cutting the search area in half.

O(log n) time · O(1) space
52 Find insert position Easy Bisect Left

Find the leftmost position where you could insert a number into a sorted list and keep it sorted.

O(log n) time · O(1) space
53 First and last occurrence Medium Bisect Left/Right

Find where a number first and last appears in a sorted list that may have duplicates.

O(log n) time · O(1) space
54 Integer square root Easy Binary Search

Find the largest integer whose square is less than or equal to x.

O(log x) time · O(1) space
55 Find peak element Medium Binary Search

Find any element in an array that is bigger than both its neighbors.

O(log n) time · O(1) space
56 Min in rotated sorted array Medium Binary Search

Find the smallest number in a sorted array that has been rotated (e.g., [4,5,6,7,0,1,2]).

O(log n) time · O(1) space