Sliding Window Approach | Longest Continuous Increasing Subsequence | LeetCode 674.
Вставка
- Опубліковано 18 вер 2024
- The Best Place To Learn Anything Coding Related - bit.ly/3MFZLIZ
Join my free exclusive community built to empower programmers! - www.skool.com/...
Preparing For Your Coding Interviews? Use These Resources
--------------------
(My Course) Data Structures & Algorithms for Coding Interviews - thedailybyte.d...
AlgoCademy - algocademy.com...
Daily Coding Interview Questions - bit.ly/3xw1Sqz
10% Off Of The Best Web Hosting! - hostinger.com/...
Follow Me on X/Twitter - x.com/nickwhit...
Follow My Instagram - / nickwwhite
Other Social Media
----------------------------------------------
Discord - / discord
Twitch - / nickwhitettv
TikTok - / nickwhitetiktok
LinkedIn - / nicholas-w-white
Show Support
------------------------------------------------------------------------------
Patreon - / nick_white
PayPal - paypal.me/nick....
Become A Member - / @nickwhite
#coding #programming #softwareengineering
Playlist Request: All problem solutions by Nick White that implement sliding window
Do you guys really think people fall for these?
Hello there, Nick. I'm one of your more recent subscribers! Pretty neat channel! Hey, while we're on the topic of Sliding Window, Do you think you could explain Why LeetCode #560 Can not be solved with a Sliding Window Technique? Thank you very much, sir.
Thanks Nick for great explanation !
you're unmatchable
I think this can also be solved using stacks using the idea next greatest index to the right and keep track of stack size during each iteration
Can you please make a video when the array is non contiguous 🙏♥️
Thanks sir its all so beneficial for us, keep doing....
I think the question says subarray. Since the subsequences aren't necessarily contiguous.
Dude, this is more of closing a window and opening another window than sliding window. You only got one pointer, for sliding window u need 2
such a smooth answer
wow I knew of this concept but did not know of the "sliding window" name
Also, suppose if I want to find the Longest Common Subsequence consider increasing subsequence then how to use a sliding approach ?? Is it gonna return quadratic time complexity since I will need two for loops to iterate over two strings?
Then how to print the subsequence? 🤔 I tried but didn't work
Did you find the solution? print the longest continuous increasing number?
remember u had that im bloomberg contest ?
please help me !! print the longest continuous increasing number?
thank you
why do you need the && i > 0 in the if condition? it seems obsolete
keep the boundary to stay in the loop
segmentation fault since for i=0 it will compare to i-1 i.e 0-1, which is out of index;
Flexport rejected me unbelievable
nooo !
Not explained all details,
Interesting perhaps someone can hep me, I have this code class Solution {
public int findLengthOfLCIS(int[] nums) {
if (nums.length == 1) {
return 1;
}
int maxCount = 1;
int maxSum = nums[0];
int currSum = nums[0];
int L = 0, R = 1, N = nums.length;
while (R < N) {
if (nums[R - 1] < nums[R]) {
currSum += nums[R];
if (currSum > maxSum) {
maxCount = Math.max(maxCount, R - L + 1 );
maxSum = currSum;
R++;
} else {
}
} else {
L = R;
R++;
currSum = nums[L];
}
}
return maxCount;
}
}
but I'm getting a TLE.
Great👍(
quick question: when we do nums[i-1] >= nums[i] the for loop starts at 0 -- so i - 1 = -1? so I'm a bit confused how this code is working? Shouldn't I try to start my loop from 1 instead? I tried that in python and its giving me error.
There's also i>0 condition in his if statement.