We use a deque to maintain the k elements and find maximums easily. When we find an element in the array greater than the top element, we remove lower elements from the deque since the max is changing. We continue this until we find a bigger element in the deque than the current element in the array. When i > k - 1, we add the answer because our window is at least k elements wide. We also maintain the correct size by checking i - k
some unimportant info: deque is pronounced as “deck.” for eg: deck of cards .. it is short form of double-ended-queue .. anyway concept is important not names
Bhaiya, after seeing you solve the example, without even seeing you write the pseudo code I was able to solve the question by myself. Thing is, I am not able to think of the approach till you solved the example. I don't know how to come up with the approach myself.
Good post, slow down the releases and you’ll get more views. Nobody can handle viewing and reviewing and learning 3-4 leetcode problems a day. Maybe a speed of one every few days is better
That's personal issue, he's already working in a company so as per his valuable time he uploads video's just for us,insteading of asking him for slow releases you yourself can manage your time as you are in need not him.
@@sarveshkulkarni6287 Of course I can manage my time. My suggestion is not for me, but for his channel. Most people will skip multiple videos if the speed of delivery is too fast. So (for his channel and engagement) I made the suggestion that he should slow the release, that way he will get more clicks. Monetizing youtube videos is not as simple as one would think. You only make money on the views during the first few days of the videos release. If he releases multiple videos and the majority of the engagement/views are not immediate, he will not get much money from releasing this content.
We use a deque to maintain the k elements and find maximums easily.
When we find an element in the array greater than the top element, we remove lower elements from the deque since the max is changing.
We continue this until we find a bigger element in the deque than the current element in the array.
When i > k - 1, we add the answer because our window is at least k elements wide.
We also maintain the correct size by checking i - k
nice summarisation
I dont comment usually but i would suggest to look the same que from his old playlist. He has explained better there.
some unimportant info:
deque is pronounced as “deck.” for eg: deck of cards .. it is short form of double-ended-queue .. anyway concept is important not names
best video on sliding window maximum problem
cap
Bhaiya, after seeing you solve the example, without even seeing you write the pseudo code I was able to solve the question by myself. Thing is, I am not able to think of the approach till you solved the example. I don't know how to come up with the approach myself.
Thanks Striver
His previous video on same topic explains same concept very detaily
thanks for showing a unsorted data version. Data is never sorted!
GOT YOU BOTHER RAJ
thanks bhaiya
understood!
UNDERSTOOD;
thanks sir
understood
tysm sir
SANK YOU, THANK YOU
Bhya ❤👍👍
understooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooood !?!?!! IDK
😄
striver not teaching well as compare with old video only expression giving
Yes, I also felt the same. He is not teaching in this playlist like earlier all playlist
I agreed. This Stack and Queue playlist is bad tbh.
Bhai ek toh dono data structures ko ek hi playlist mein kyu add kar diya 🤦♂️
Felt the same, i am going back and checking his old video:)
Bhai course launch karne ke baad mindset pura badal jaata hai...
@@Ayush37262 right
first
Good post, slow down the releases and you’ll get more views. Nobody can handle viewing and reviewing and learning 3-4 leetcode problems a day. Maybe a speed of one every few days is better
apni suggestion apne paas rkh
That's personal issue, he's already working in a company so as per his valuable time he uploads video's just for us,insteading of asking him for slow releases you yourself can manage your time as you are in need not him.
@@sarveshkulkarni6287 Of course I can manage my time. My suggestion is not for me, but for his channel. Most people will skip multiple videos if the speed of delivery is too fast. So (for his channel and engagement) I made the suggestion that he should slow the release, that way he will get more clicks.
Monetizing youtube videos is not as simple as one would think. You only make money on the views during the first few days of the videos release. If he releases multiple videos and the majority of the engagement/views are not immediate, he will not get much money from releasing this content.
@@WebSurfingIsMyPastime bro jisne padna vo channel search kr ke pad lega.
@@WebSurfingIsMyPastimeWhy are you considering that only first few days would account for the views? Think about the long run mate.
understood