Znajdź minimum w obróconej tablicy posortowanej
// https://leetcode.com/problems/find-minimum-in-rotated-sorted-array
// assuming Array has no duplicates
class Solution {
public int findMin(int[] nums) {
int start = 0;
int end = nums.length-1;
while (start < end){
int mid = start + (end-start)/2;
if (nums[mid] > nums[end]) start = mid+1;
if (nums[mid] < nums[end]) end = mid;
}
return nums[start];
}
}
Prabhu Kiran Konda