FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Leetcode/0153_Find_Minimum_in_Rotated_Sorted_Array.cpp at main · Nothing-avil/Leetcode · GitHub
Nothing-avil
/
Leetcode
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Leetcode
/
0153_Find_Minimum_in_Rotated_Sorted_Array.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
19 lines (19 loc) · 614 Bytes
Breadcrumbs
Leetcode
/
0153_Find_Minimum_in_Rotated_Sorted_Array.cpp
Copy path
File metadata and controls
19 lines (19 loc) · 614 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
#
pragma
GCC optimize("Ofast","inline","ffast-math","unroll-loops","no-stack-protector")
#
pragma
GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native","f16c")
class
Solution
{
public:
int
findMin
(vector<
int
>& nums) {
ios_base::sync_with_stdio
(
0
), cin.
tie
(
0
), cout.
tie
(
0
);
int
n= nums.
size
();
if
(nums[
0
] <= nums[n -
1
])
return
nums[
0
];
int
l=
0
, r=n-
1
;
while
(l<r){
int
mid= (l + r) >>
1
;
if
(nums[
0
] <= nums[mid])
l = mid +
1
;
else
r = mid;
}
return
nums[l];
}
};
Back
|
FazBrowse Home
|
New Git URL