We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7ad44a commit ada0cc4Copy full SHA for ada0cc4
find-minimum-in-rotated-sorted-array/kimjunyoung90.java
@@ -0,0 +1,18 @@
1
+// 요구사항 : 이진 탐색 이용
2
+class Solution {
3
+ public int findMin(int[] nums) {
4
+ int left = 0;
5
+ int right = nums.length - 1;
6
+ while(left < right) {
7
+ int mid = (left + right) / 2;
8
+ //중앙 값이 오른쪽 값보다 크다. = 최소값이 오른쪽 구간에 있음
9
+ if(nums[mid] > nums[right]) {
10
+ left = mid + 1;
11
+ } else {
12
+ right = mid;
13
+ }
14
15
+
16
+ return nums[left];
17
18
+}
0 commit comments