← Back LeetCode →

Search in Rotated Sorted Array

LeetCode 33 • Medium • Binary Search

Sorted array rotated at unknown pivot. Find target in O(log n). One half is always sorted — compare target to endpoints to decide which side to search.

TimeO(log n)halve
SpaceO(1)
Step0/8
Ready
Watch lo, hi, mid. Identify which side is sorted, then check if target lies in that range.