public int findMin(int[] num) {//AC
        //
    	int start = 0;
    	int end = num.length - 1;
    	
    	while (num[start] >= num[end])
    	{
    		if (end - start == 1)
    			return num[end];
    		int mid = (start + end) / 2;
    		if (num[start] == num[mid] && num[mid] == num[end])
    		{
    			//sequential search
    			int min = num[start];
    			for (int i = start + 1; i <= end; ++i)
    			{
    				if (num[i] < min)
    					min = num[i];
    			}
    			return min;
    		}
    		else if (num[mid] >= num[start])
    		{
    			start = mid;
    		}
    		else
    		{
    			end = mid;
    		}
    	}
    	return num[start];
    }