package com.matao;

/**
 * Created by matao on 2018-12-10.
 */
public class Q11_MinNumberInRotatedArray {
}

@@ -17,92 +17,846 @@
 o;%0A%0A
-/**%0A * Created by matao on 2018-12-10.%0A */%0Apublic class Q11_MinNumberInRotatedArray %7B
+import com.matao.common.InvalidParameterException;%0A%0A/**%0A * Created by matao on 2018-12-10.%0A * %3Cp%3E%0A * %E6%8A%8A%E4%B8%80%E4%B8%AA%E6%95%B0%E7%BB%84%E6%9C%80%E5%BC%80%E5%A7%8B%E7%9A%84%E8%8B%A5%E5%B9%B2%E4%B8%AA%E5%85%83%E7%B4%A0%E6%90%AC%E5%88%B0%E6%9C%AB%E5%B0%BE%E6%88%90%E4%B8%BA%E6%95%B0%E7%BB%84%E7%9A%84%E6%97%8B%E8%BD%AC%EF%BC%8C%E5%A6%82:%0A * 1 2 3 4 5 =%3E 3 4 5 1 2%0A * 0 1 1 1 1 =%3E 1 1 1 0 1%0A * 0 1 1 1 1 =%3E 1 0 1 1 1%0A * %E6%B1%82%E4%B8%80%E4%B8%AA%E5%8E%9F%E6%9C%AC%E9%80%92%E5%A2%9E%E7%9A%84%E6%95%B0%E7%BB%84%E6%97%8B%E8%BD%AC%E5%90%8E%E7%9A%84%E6%9C%80%E5%B0%8F%E6%95%B0%E5%AD%97%E3%80%82%0A */%0Apublic class Q11_MinNumberInRotatedArray %7B%0A%0A    /**%0A     * %E4%BA%8C%E5%88%86%E6%9F%A5%E6%89%BE%E3%80%82%0A     * %E5%8E%9F%E6%9C%AC%E6%9C%89%E5%BA%8F%EF%BC%8C%E8%BF%9B%E8%A1%8C%E4%BA%86%E6%97%8B%E8%BD%AC%EF%BC%8C%E4%BD%86%E5%9C%A8%E4%B8%80%E5%AE%9A%E7%A8%8B%E5%BA%A6%E4%B8%8A%E8%BF%98%E6%98%AF%E6%9C%89%E5%BA%8F%E7%9A%84%E3%80%82%0A     */%0A    public int min(int%5B%5D array) %7B%0A        if (array == null %7C%7C array.length == 0) %7B%0A            throw new InvalidParameterException(%22array cannot be null or empty%22);%0A        %7D%0A%0A        int start = 0;%0A        int end = array.length - 1;%0A%0A        while (start %3C end) %7B%0A            int mid = start + (end - start) / 2;%0A%0A            if (array%5Bmid%5D %3E array%5Bend%5D) %7B%0A                start = mid + 1;%0A            %7D else %7B%0A                end = mid;%0A            %7D%0A        %7D%0A        return array%5Bstart%5D;%0A    %7D
 %0A%7D%0A

add Q11 MinNumberInRotatedArray