From 36f84eded0c67073a58a51ac899676ab12f7327c Mon Sep 17 00:00:00 2001 From: chayan das Date: Tue, 14 Oct 2025 23:55:13 +0530 Subject: [PATCH] Create 3349. Adjacent Increasing Subarrays Detection I --- ... Adjacent Increasing Subarrays Detection I | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 3349. Adjacent Increasing Subarrays Detection I diff --git a/3349. Adjacent Increasing Subarrays Detection I b/3349. Adjacent Increasing Subarrays Detection I new file mode 100644 index 0000000..e898b2b --- /dev/null +++ b/3349. Adjacent Increasing Subarrays Detection I @@ -0,0 +1,28 @@ +class Solution { +public: + bool hasIncreasingSubarrays(vector& nums, int k) + { + vector store; + nums.push_back(-1005); + + int count = 1, n = nums.size(); + for(int i = 1; i < n; i++) + { + if(nums[i - 1] < nums[i]) count += 1; + else + { + store.push_back(count); + count = 1; + } + } + + for(auto &val : store) + if(val >= (k + k)) return true; + + n = store.size(); + for(int i = 1; i < n; i++) + if(store[i - 1] >= k and store[i] >= k) + return true; + return false; + } +};