- Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSolution154.java
More file actions
Latest commit
24 lines (23 loc) · 626 Bytes
/
Copy pathSolution154.java
File metadata and controls
24 lines (23 loc) · 626 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/**
* Created by slade on 2019/12/31.
*/
publicclassSolution154 {
publicintfindMin(int[] nums) {
intleft = 0;
intright = nums.length - 1;
while (left < right) {
intmid = (left + right) >> 1;
if (nums[mid] < nums[right]) {
right = mid;
} elseif (nums[mid] > nums[right]) {
left = mid + 1;
} else {
--right;
}
}
returnnums[left];
}
publicstaticvoidmain(String[] args) {
System.out.println(newSolution154().findMin(newint[]{3,1,1,3}));
}
}