mirror of
https://github.com/lWolvesl/leetcode.git
synced 2026-01-12 18:08:38 +08:00
251103
This commit is contained in:
33
25/10/3349.cpp
Normal file
33
25/10/3349.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
bool hasIncreasingSubarrays(vector<int>& nums, int k) {
|
||||
if(k == 1 && nums.size() > 1){
|
||||
return true;
|
||||
}
|
||||
vector<int> s;
|
||||
int temp = 1;
|
||||
for(int i = 1;i<nums.size();++i){
|
||||
if(nums[i] > nums[i-1]){
|
||||
temp++;
|
||||
if(temp >= 2 * k){
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(temp >= k){
|
||||
s.push_back(temp);
|
||||
if(s.size() > 1){
|
||||
return true;
|
||||
}
|
||||
temp = 1;
|
||||
continue;
|
||||
}
|
||||
while (s.size() > 0)
|
||||
{
|
||||
s.pop_back();
|
||||
}
|
||||
temp = 1;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user