@@ -0,0 +1,876 @@
+package problems;%0A%0Apublic class MinimumInRotatedSortedArray2 %7B%0A    public int findMin(int%5B%5D num) %7B%0A        if (num == null %7C%7C num.length == 0)%0A            return 0;%0A%0A        return findMinHelper(num, 0, num.length - 1);%0A    %7D%0A    %0A    int findMinHelper(int%5B%5D A, int l, int r) %7B%0A        if (r - l %3C= 1)%0A            return Math.min(A%5Bl%5D, A%5Br%5D);%0A        %0A        int mid = (l + r) / 2;%0A        if (A%5Bmid%5D %3E= A%5Bl%5D && A%5Bmid%5D %3E A%5Br%5D)%0A            return findMinHelper(A, mid, r);%0A        if (A%5Bmid%5D == A%5Bl%5D && A%5Bmid%5D == A%5Br%5D)%0A            return Math.min(findMinHelper(A, mid, r), findMinHelper(A, l, mid - 1));%0A        return findMinHelper(A, l, mid);%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        MinimumInRotatedSortedArray2 ma = new MinimumInRotatedSortedArray2();%0A        int%5B%5D A = %7B 4, 5, 6, 7, 0, 0, 0, 0, 0 %7D;%0A%0A        System.out.println(ma.findMin(A));%0A    %7D%0A%7D%0A

Add Minimum in Rotated Sorted Array 2