Search a target number in a Rotated Sorted Array.
Utilisateur anonyme
public int search(int[] nums, int target) { int start = 0; int end = nums.length - 1; while (start = nums[start]) { end = mid - 1; } else { start = mid + 1; } } else { //5 6 7 1 2 3 4, 6 if (target > nums[mid] && target <= nums[end]) { start = mid + 1; } else { // end = mid - 1; } } } return -1; }