No video

L1. Introduction to Sliding Window and 2 Pointers | Templates | Patterns

  Рет қаралды 183,714

take U forward

take U forward

Күн бұрын

Notes/Codes/Problem links under step 10 of A2Z DSA Course: takeuforward.o...
Entire playlist: • Two Pointer and Slidin...
Follow us on our other social media handles: linktr.ee/take...

Пікірлер: 191
@varun1017
@varun1017 5 ай бұрын
Petition to Striver. We want strings.
@AJAYKUMARRAJPUT-gl4tm
@AJAYKUMARRAJPUT-gl4tm 5 ай бұрын
I'm also waiting for it
@mr.rexalan5576
@mr.rexalan5576 5 ай бұрын
yes we want strings
@insidious_681
@insidious_681 5 ай бұрын
Yes striver sir 🙌
@FilmLover65
@FilmLover65 5 ай бұрын
yes we want strings
@ShivaaySingh20
@ShivaaySingh20 5 ай бұрын
Yes , please make series on strings.
@vect0r678
@vect0r678 4 ай бұрын
Petition to Striver - We want string playlist ASAP!!
@user-of5fb6nb9e
@user-of5fb6nb9e 5 ай бұрын
Despite your busy schedule, you still manage to deliver invaluable content like this. I salute you, sir! Thank you very much for the teachings.
@harshsheth5545
@harshsheth5545 3 ай бұрын
31:28 One more big optimization is possible in the longest subarray solution. if (arr[r]>k) { r=r+1; l=r; sum=0} Here if a number itself is greater than 'k' then no subarray with that element can be a valid substring. So, we can move both left and right pointers to the next element (i.e. arr[r+1])
@antor.morsalin
@antor.morsalin Ай бұрын
while optimizing, you kinda have to expect the input that is the most time consuming.
@rajatraj4297
@rajatraj4297 5 ай бұрын
gurudev aaj ka leetcode daily dekh ke socha tha, striver ka sliding window kab aayega. aur aapne sun bhi li 😌
@nefarious001
@nefarious001 3 ай бұрын
VOTE FOR STRING PLAYLIST
@InWonderland-z2l
@InWonderland-z2l Ай бұрын
these kind of template videos are so awesome. useful for revision + wraps up the entire concept and makes it so much easier to understand the modifications in the different problems
@angeldeveloper
@angeldeveloper 5 ай бұрын
Most awaited playlist🎉🎉🎉
@suryasaipalthi
@suryasaipalthi 5 ай бұрын
Man, this is really cool I am ngl I came across a sliding window sum today and was struggling today to do it, and here we are. Let's strive all the way. Thank you!
@omkarshendge5438
@omkarshendge5438 29 күн бұрын
we do it while(r
@Arsun-77
@Arsun-77 9 күн бұрын
in his terms he is conveying us as upto n-1 which is similar to r
@uditpanjiyar3203
@uditpanjiyar3203 5 ай бұрын
today leetcode problem of the day is based on sliding window topic , and i am searching for the playlist of sliding window on youtube and you just launched complete playlist of S.W ammazzing you are great 🙏🙏
@mansimishra7089
@mansimishra7089 5 ай бұрын
This is something I was wishing 2 days back. Thanks Bhaiya :)
@tasneemayham974
@tasneemayham974 4 ай бұрын
LONG AWAITEDDD SERIESS!!! THANK YOUUUUU STRIVERRRRRR SOO SOO OSOO MUCHHHHHH!!!! I am currently studying the graph series once I am done. I will jump to this one!!
@tanvirahammed3783
@tanvirahammed3783 5 ай бұрын
Hi Striver, I'm not sure if this comment will reach you or not, but I just want to say one thing: I've been watching your videos for more than a year now and have covered a huge part of the graph and dynamic programming playlists. Whenever I watch your videos, I really fall in love with your teaching style, and of course, your smile, and sometimes your small jokes. I enjoy your videos, and it feels like you're not just my tutor; it feels like you're someone very close to me, teaching me with fun and pleasure. However, in your recent playlists, I totally miss that. It feels like you're not as friendly anymore; you're just a teacher like any other tutor. Whenever I watch videos from this playlist, sometimes I wonder what happened to you. Why are you so quiet now? Why don't you joke around anymore? After all, I love your work; it's just my opinion.
@sanskargupta2739
@sanskargupta2739 5 ай бұрын
Petition to striver: we want string playlist
@arnav7050
@arnav7050 5 ай бұрын
Thumbnail upgrade crazyyy…thanx for your efforts….eagerly waiting for strings
@user-of8ix7oq9t
@user-of8ix7oq9t 2 ай бұрын
Hi, Thanks for the video first of all 😊, but at time 12:28, we can't break from the loop (as you did in else condition) as array can have negative elements further which will reduce sum and it can bring sum to less than or equal to k. That else condition is fine only when we don't have negative elements in the array. At 21:05, we don't need the if condition to check if sum
@aishwaryaanand5650
@aishwaryaanand5650 Ай бұрын
At 21:55, isn’t it important for the while loop to have one more condition i.e l
@kunalwadhai777
@kunalwadhai777 5 ай бұрын
Striver Bhaiya, I have just watched the introductory video of this playlist, and feels like it's a very cool explanation, I'm getting everything that you are saying for I am very grateful to you.
@a_13_balaji_k44
@a_13_balaji_k44 4 ай бұрын
5:20 why no one is talking about the issue in the first problem , the first subarray isn't considered why? and no conditions given inside while loop why? Here is the Correct code int nums[] = new int[] {6,2,3,-1,-5,1,1}; int k = 3; int left = 0; int right = 0; int sum = 0; int maxSum = Integer.MIN_VALUE; while(right
@sultan_3006
@sultan_3006 4 ай бұрын
I was also wondering why no one has commented on that part!
@prasannasahoo0806
@prasannasahoo0806 3 ай бұрын
we will calculate the sum for the first subarray also and we later compare it with the upcoming subarrays sum . hope I made it clear
@purushottam108
@purushottam108 2 ай бұрын
before going to loop we can put maxSum = sum it also work fine: #include using namespace std; int main(){ int k = 2; vectorarr = {100,-2,1,-7,-1,10}; int sum = 0; int maxsum = INT_MIN; for (int i = 0; i < arr.size(); i++)sum = sum + arr[i]; int l = 0; int r = k-1; maxsum = sum;//so we dont miss the sum of first subarray while (r < arr.size()-1) { sum = sum - arr[l]; l++; r++; sum = sum + arr[r]; maxsum = max(maxsum,sum); } cout
@rahulmahajan2412
@rahulmahajan2412 22 күн бұрын
basically we get that subarray sum in that iteration only. So no need to iterate the last element
@vishwaskalra8773
@vishwaskalra8773 5 ай бұрын
Today i was thinking when will striver be teaching Sliding Window nd here it comes 🎉
@sejalpawar7076
@sejalpawar7076 24 күн бұрын
Best video I have watched for Sliding window till date
@omkharade9521
@omkharade9521 5 ай бұрын
My motivation to continue grinding.
@thaman701
@thaman701 5 ай бұрын
Striver bro---we want string palylist
@srishtipandey6068
@srishtipandey6068 5 ай бұрын
Please upload greedy and heaps playlist too #striver
@KartikeyTT
@KartikeyTT 4 ай бұрын
Greedy is coming next weekend
@user-il9wr5du1y
@user-il9wr5du1y 4 ай бұрын
Amazing explanation, but one input from my side would be that before updating the window, we should check if(l
@prasannasahoo0806
@prasannasahoo0806 3 ай бұрын
i don't think so .. ig the first element is 15 then l++ will happen and r++ to so we will move to the second element and will create subarrays from there .
@user-sp8ne7hj3n
@user-sp8ne7hj3n 5 ай бұрын
King is back with DSA..
@shwetanshusinha2690
@shwetanshusinha2690 5 ай бұрын
Was waiting for this playlist from a long time. Thank u so much sir
@Cool96267
@Cool96267 3 ай бұрын
Thankyou so much Striver for all you efforts throughout in delivering us so much valuable content. Any student / working professional can now be able to transition their career without paying money for courses. Would also like your insights on the point : While preparing for interviews most of the aspirants are going through the videos solely and solving the question after completely watching the video. And also are feeling lazy trying to solve the question on our own. What is the best way to complete any topic without being lazy and how should an aspirant approach any topic/playlist?
@ropurifiedwater
@ropurifiedwater 5 ай бұрын
just saw this intro video and was able to solve the leetcode problem of the day (28th march) i am hyped up for this playlist!!
@abhay3545
@abhay3545 5 ай бұрын
Best intro of any series on KZfaq 🎉
@atulwadhwa192
@atulwadhwa192 5 ай бұрын
Most awaited series
@ibrahimlanre4285
@ibrahimlanre4285 5 ай бұрын
bro striver i am so grateful for all you do ...but please a simple request on the heaps and string playlist🙏
@xavier4107
@xavier4107 4 ай бұрын
Petition to Striver: We want playlists on Strings & Prefix Sum logic, heap & updated playlist on hashing
@harshvardhansankpal716
@harshvardhansankpal716 5 ай бұрын
5:38 in this problem the sum of first subarray is not being considered, plz store it in a separate variable and put in maxi( ) as well, or after finding the sum using for loop assign max_sum= sum; in that case we dont need an extra variable
@priyanshugagiya
@priyanshugagiya 4 ай бұрын
Optimization was so great 🥵 I never thought about improving 2n to n
@harshsheth5545
@harshsheth5545 3 ай бұрын
It is important to note that Pattern 2 is applicable for positive numbers only. In your case itself if the array was [2,5,1,7,-5,10] instead of [2,5,1,7,10] your solution would be wrong.
@prasannasahoo0806
@prasannasahoo0806 3 ай бұрын
can you explain how ?
@harshsheth5545
@harshsheth5545 3 ай бұрын
@@prasannasahoo0806 sure. During the execution when L is at position 0 and R is at position 3, the subarray 2,5,1,7 gives the sum 15 which is greater than 14 so L will move to position 1. The new sub array now is 5,1,7. Then R moves to position 4 but L does not move back to position 0. So, the subarray 2,1,5,7,-5 which is a valid array but it is not checked in this method.
@franciskp9117
@franciskp9117 5 ай бұрын
Hey man, was waiting for this playlist for a long time. Appreciate your efforts
@thestarters9799
@thestarters9799 5 ай бұрын
For else if(sum > k) break; There may be negative elements in array right?
@dracoadi6239
@dracoadi6239 Ай бұрын
best concept explanation so far
@hashcodez757
@hashcodez757 4 күн бұрын
UNDERSTOOD BHAIYA!!
@user-vs8xp2kk4b
@user-vs8xp2kk4b 5 ай бұрын
💯 / 10 teacher for dsa..
@user-ym1nv1pw8i
@user-ym1nv1pw8i 2 ай бұрын
Revise optimal @30:00 Understood! Mark for revision
@as_if
@as_if 15 күн бұрын
1. Sliding window 2. Recursion revision 3. Then I'll move on to hard questions of graph or tree
@fangirltalent5402
@fangirltalent5402 29 күн бұрын
Can someone please explain that in optimised solution,when sum is 16 it is still >14 so how did we move r since condition for r is if(sum
@blitztour5924
@blitztour5924 5 ай бұрын
Completed this amazing Video. Going to Blitz through every question/video now😈
@kashafkhan9726
@kashafkhan9726 5 ай бұрын
Was in waiting ✋️ list for this from a long time ⏲️.
@monikayadav-wb6pu
@monikayadav-wb6pu 5 ай бұрын
Thank you so much ❤bhaiya apki sari videos kaffi helpful rahi hai hamare liye
@ParthKamal-iy9bf
@ParthKamal-iy9bf 3 ай бұрын
you are doing great work striver
@saibhanu4142
@saibhanu4142 Ай бұрын
Sir a small doubt , for (i=0 --> n-1) doe this mean for(i=0;i
@whamjampamham
@whamjampamham 4 ай бұрын
Those who agree we need strings playlist.
@eesnehhil
@eesnehhil 3 ай бұрын
Yessssss
@devshubham5528
@devshubham5528 2 ай бұрын
108k views and just 3.4k likes why people don't appreciate the creator. Always give it a like when you learned something from the video
@shahriaralom2903
@shahriaralom2903 5 ай бұрын
Today i was thinking when will striver be teaching Sliding Window nd here it comes (2)
@prayasjain8104
@prayasjain8104 Ай бұрын
New to DSA, Want to understand for 2nd pattern Longest subarray where sum
@abhinavnarula7300
@abhinavnarula7300 5 ай бұрын
I have a small doubt in the 2nd pattern's better approach, shouldn't we also check for l
@AjithKumaR-jw9wt
@AjithKumaR-jw9wt 5 ай бұрын
Yes, at the end we can put a condition if r less than l mean r equal to l plus one
@hat_awesome21
@hat_awesome21 5 ай бұрын
Thanks a lot bro 🙏 ❤️
@rishabhnema2479
@rishabhnema2479 5 ай бұрын
Thank you Sir! There was no playlist or videos regarding two pointers or sliding window on KZfaq. Leetcode daily is asking problems related to it currently, would prove to be of great help.
@ankittjindal
@ankittjindal 5 ай бұрын
Check aditya verma sliding window playlist too bro
@nayeemrafsan356
@nayeemrafsan356 4 ай бұрын
this content is invaluable! can't thank you enough
@Arya20012
@Arya20012 4 ай бұрын
Thank you striver ❤, you are our hero
@aishwarya156
@aishwarya156 5 ай бұрын
Awesome Bro! Great teaching skills!
@LinhHoang-ml1qo
@LinhHoang-ml1qo 3 ай бұрын
thanks for your dedication !
@t-anime517
@t-anime517 4 ай бұрын
guru dev dhanyawad🙏
@priyan8004
@priyan8004 4 ай бұрын
Man ! you are amazing.
@hawkop2386
@hawkop2386 Ай бұрын
Bro do more videos based on these kind of approaches bro
@survivourff7014
@survivourff7014 5 ай бұрын
Tnq so much striver bhaiya...
@newbie8051
@newbie8051 Ай бұрын
8:00 sort karke we can apply two pointer approach right ? As in 3sum and 4sum problems But fir wohi hai, array needs to be sorted
@anujkapri6054
@anujkapri6054 5 ай бұрын
Can we have playlist on strings. Please
@unknown72900
@unknown72900 5 ай бұрын
Thank you so much for this playlist sir 🙏🏻🫂❤️
@rishabhnema2479
@rishabhnema2479 5 ай бұрын
One playlist needed for greedy algo too.
@NikhilKumar-xg7re
@NikhilKumar-xg7re 5 ай бұрын
Much needed playlist btw which app do you use for notes ?? what is the name of this app ??♥♥♥
@dipendrasingh4874
@dipendrasingh4874 5 ай бұрын
bhaiya aaj ke contest me first time 3 question hua 🙂🙂🙂🙂because of you thank you
@SanjeevM-yc5uj
@SanjeevM-yc5uj 4 ай бұрын
For the 3rd type where you find the number of subarrays satisfying the condition, can’t we just add an extra variable and check if the subarray is satisfying the equal condition and then increase the variable’s value accordingly. Like for example can’t we just include a variable called sub_array_count and then add 1 to it whenever sum = k inside the loop itself?
@aniketrangari8679
@aniketrangari8679 4 ай бұрын
simplest way to learn
@torishi82
@torishi82 3 ай бұрын
Samaj aa gaya.
@rishabhnema2479
@rishabhnema2479 5 ай бұрын
Could you please add additional problems where instead of sum, product of subarrays pattern is taken.
@ganeshjaggineni4097
@ganeshjaggineni4097 2 ай бұрын
NICE SUPER EXCELLENT MOTIVATED
@tier3wala
@tier3wala 5 ай бұрын
Thanks for Sharing bhaiya !! Stack ka v upload kar divine !! ❤️🫠
@shivanshmahajan2281
@shivanshmahajan2281 5 ай бұрын
Finnally wait is over 😊
@user-zk4og6sy1d
@user-zk4og6sy1d 5 ай бұрын
Thanks for uploading 🙏
@manikantareddy9454
@manikantareddy9454 3 ай бұрын
great work sir🙌
@ritikanand3425
@ritikanand3425 5 ай бұрын
Thank You for the efforts
@abdullaaliyar9602
@abdullaaliyar9602 20 күн бұрын
13:10 does the logic of break works if the arrays contains negative elements ?
@dEviL_bIsWaJiT
@dEviL_bIsWaJiT 4 ай бұрын
Thanks a lot bhaiya 💙
@rajsharmawatch
@rajsharmawatch 3 ай бұрын
petition to striver we want string playlist
@aditya_raj7827
@aditya_raj7827 Ай бұрын
understood
@user-rk2vo5zb3e
@user-rk2vo5zb3e 5 ай бұрын
Really Helpful!
@sushma_1704
@sushma_1704 5 ай бұрын
Thank u very much bhaiya
@akashsoam7581
@akashsoam7581 5 ай бұрын
we a similar small playlist for prefix sum
@prajyot2021
@prajyot2021 2 ай бұрын
thanks Raj
@Chai_parathe
@Chai_parathe 5 ай бұрын
Striver pls make string playlist 🥺
@subee128
@subee128 5 ай бұрын
Thank you very much
@JohnWickea
@JohnWickea 5 ай бұрын
wow finally 😍 . Thanks
@adityapandey23
@adityapandey23 Ай бұрын
Understood
@codeman3828
@codeman3828 4 ай бұрын
Thanks. Understood
@ravigupta9784
@ravigupta9784 4 ай бұрын
Thanks a lot🙂
@user-tk2vg5jt3l
@user-tk2vg5jt3l 4 ай бұрын
Thank you bhaiya
@RitikRaj-we2sc
@RitikRaj-we2sc 5 ай бұрын
Hey striver great video as usual. I wanted to ask about the update on intern position that you posted on linkedin. Have you started to review the assignments ?
@navinchaudhary2812
@navinchaudhary2812 5 ай бұрын
understood bhaiya
@LighBearer
@LighBearer 5 ай бұрын
Thank You
@banothutharun2743
@banothutharun2743 4 ай бұрын
superb bro
@sultan_3006
@sultan_3006 4 ай бұрын
Can anyone explain me (IN DETAIL) optimal approach of 2nd pattern. Thanks In Advance!!!
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
ROLLING DOWN
00:20
Natan por Aí
Рет қаралды 11 МЛН
OMG what happened??😳 filaretiki family✨ #social
01:00
Filaretiki
Рет қаралды 13 МЛН
Blue Food VS Red Food Emoji Mukbang
00:33
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 24 МЛН
Happy birthday to you by Tsuriki Show
00:12
Tsuriki Show
Рет қаралды 12 МЛН
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 467 М.
Golang pointers explained, once and for all
13:49
JamieGo
Рет қаралды 5 М.
L5. Fruit Into Baskets | 2 Pointers and Sliding Window Playlist
30:02
take U forward
Рет қаралды 56 М.
10 Math Concepts for Programmers
9:32
Fireship
Рет қаралды 1,8 МЛН
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 202 М.
How to Solve ANY LeetCode Problem (Step-by-Step)
12:37
Codebagel
Рет қаралды 190 М.
My Brain after 569 Leetcode Problems
7:50
NeetCode
Рет қаралды 2,5 МЛН
ROLLING DOWN
00:20
Natan por Aí
Рет қаралды 11 МЛН