```
public int findMin(int[] num) {
return min(num, 0, num.length-1);
}
int min(int[] num, int left, int right) {
if (right - left <= 1) {
return num[left] < num[right] ? num[left] : num[right];
}
int mid = (right+left)/2;
if (num[mid] < num[right]) {
return min(num, left, mid);
} else if (num[mid] > num[right]) {
return min(num, mid, right);
} else {
int leftMin = min(num, left, mid);
int rightMin = min(num, mid, right);
return leftMin < rightMin ? leftMin : rightMin;
}
}
```