Java Solution - :)


  • 2
    public int findMin(int[] a) {
        int low = 0, mid = 0;
        int high = a.length - 1;
        while(low <= high) {
        	mid = low + ((high - low)/2);
        	if(a[mid] < a[high]) {
        		high = mid;
        	}else if(a[mid] > a[high]) {
        		low = mid+1;
        	}else {
        		return a[mid];
        	}
        }
        return a[mid];
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.