Search for a command to run...
Try your own input
Change the array and replay the algorithm from step one.
Current step
Find minimum in rotated sorted array. If right half is sorted, min is in left (or mid). Otherwise min is in right.
Binary Search
1function findMin(nums) {//left: 0right: 42 let left = 0, right = nums.length - 1;3 while (left < right) {4 const mid = Math.floor((left + right) / 2);5 if (nums[mid] > nums[right]) {6 left = mid + 1;7 } else {8 right = mid;9 }10 }11 return nums[left];12}