← All problems

Search in Rotated Sorted Array

Medium searchingarrays LeetCode ↗
Search for a target value in a rotated sorted array (sorted ascending, then rotated at an unknown pivot) in O(log n) time. Duplicates are not present in the basic version.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(log n), Space O(1)

Common pitfalls

  • Wrong half identification
  • Duplicates causing O(n) unhandled

Your solution

Log in to save your code and track progress.