FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
leetcode/findminimuminrotatedsortedarray.java at master · wpande/leetcode · GitHub
wpande
leetcode
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
leetcode
/
findminimuminrotatedsortedarray.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
20 lines (20 loc) · 471 Bytes
Breadcrumbs
leetcode
/
findminimuminrotatedsortedarray.java
Copy path
File metadata and controls
20 lines (20 loc) · 471 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public
class
Solution
{
public
int
findMin
(
int
[]
nums
) {
int
res
=
nums
[
0
];
int
len
=
nums
.
length
;
if
(
res
<
nums
[
len
-
1
])
return
res
;
int
begin
=
1
;
int
end
=
len
-
1
;
while
(
begin
<=
end
){
int
mid
=(
begin
+
end
)/
2
;
if
(
nums
[
mid
]>
res
)
begin
=
mid
+
1
;
else
{
//no equal <
res
=
nums
[
mid
];
end
=
mid
-
1
;
}
}
return
res
;
}
}
Back
|
FazBrowse Home
|
New Git URL