Skip to content

Commit d13f273

Browse files
committed
find minimum in rotated sorted array
1 parent 1ef5b18 commit d13f273

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
for문 순회를 통해 최소값 찾기
3+
nums의 길이 -> N
4+
시간 복잡도 : O(N)
5+
공간 복잡도 : O(1)
6+
*/
7+
class Solution {
8+
public int findMin(int[] nums) {
9+
int result = Integer.MAX_VALUE;
10+
for(int num : nums) {
11+
result = Math.min(result, num);
12+
}
13+
return result;
14+
}
15+
}

0 commit comments

Comments
 (0)