Search in Rotated Sorted Array
Medium๐ท๏ธ Binary search๐ Recursion, Sorting & Searching
๐งฉ The problem
A sorted array of distinct numbers was rotated (e.g. [0,1,2,4,5,6,7] โ [4,5,6,7,0,1,2]). Return the index of the target or -1, in O(log n).
Examples
[4,5,6,7,0,1,2], 0 โ 4
๐ฏ Aim for: O(log n) time
โ๏ธ Write your solution
Pick a language, press Run to try it, then Run tests to check it against every test case โ just like a coding interview.