Window Sliding Technique | Why? What? When? How? | Comparison, Code Identification of Questions

  Рет қаралды 37,133

Keerti Purswani

Keerti Purswani

Күн бұрын

Пікірлер: 108
@saiyashwanth1991
@saiyashwanth1991 4 жыл бұрын
it's a pattern when you need to find something in the contiguous sub-array.
@sdef719
@sdef719 4 жыл бұрын
The explanation why this approach falls under dynamic programming is great. Learned a new lesson. Thanks ma'am.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you 😊😊
@ankitranjan88
@ankitranjan88 3 жыл бұрын
Your intution to clear the topic meaning is very effective...as i understand it in one go!
@matrixRule127
@matrixRule127 4 жыл бұрын
Actually, I was asked the same problem in my Paypal interview, but it didn't go well for me. Glad to actually find this. Awesome explanation. Thank you! 😍
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
😊😊
@FitLoki
@FitLoki Жыл бұрын
Nice explanation mam ....you explained it from the scratch itself ,this is the first video I am watching in this channel and am impressed and subscribed as well... keep doing on this topics
@CSharpProdigy
@CSharpProdigy 3 жыл бұрын
awesome video Keerti.. Nice explanation... I'm making this my classroom from henceforth.. in the second loop, it should be arr[I] instead of arr[k] Thanks..
@zmxncbv95
@zmxncbv95 2 жыл бұрын
Thank you so much for the wonderful explaination, now I got some basic idea of Window Sliding technique
@vigneshhendrix4447
@vigneshhendrix4447 4 жыл бұрын
I always love this sliding window approach! Whenever I get a prob on maximum sum subarray or product subarray,I apply this technique with happiness!😂🔥
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Yeah, once you know this, it becomes easy😇
@prasadm3614
@prasadm3614 2 жыл бұрын
M super glad that this video is in English !
@Shredder220
@Shredder220 4 жыл бұрын
Your way of teaching is way more good than those highly paid tutorials...waiting for your next video like this maam
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you 😇😇 Many videos coming up!!
@tombrady7390
@tombrady7390 4 жыл бұрын
your channel is small ,but you can be appreciate the fact that you helped the community and impacted us positively thanks :)
@abhishekhorton79
@abhishekhorton79 3 жыл бұрын
One of the most underrated channel fr
@KeertiPurswani
@KeertiPurswani 3 жыл бұрын
Please do help in removing the underrated part and share the channel with your friends. It will mean a lot to me! 😇❤️
@priyachauhan813
@priyachauhan813 2 жыл бұрын
Hi Keerthy, Thanks for the content. I tried this in Python lst_2 = [1,2,3,4,5,6,7,8,9,10] k=5 wind_sum=0 for i in range(k): wind_sum=wind_sum+lst_2[i] max_sum = wind_sum for j in range(k,len(lst_2)): next_wind_ele = lst_2[j] - lst_2[j-k] wind_sum+=next_wind_ele max_sum = max(wind_sum,max_sum) print(max_sum)
@abcdabcd8605
@abcdabcd8605 7 ай бұрын
There is a mistake in the code at line line 6, it should be, wind_sum += arr[i] -arr[i-k]; and not as wind_sum = arr[i] -arr[i-k];
@rahuldantuluri
@rahuldantuluri 3 жыл бұрын
HI Keerthi, Great job as always. Little curious at 9:41 shouldn't it be arr[i] instead of arr[k]?
@kurmasaideep4072
@kurmasaideep4072 2 жыл бұрын
yes bro .. i was finding where the bug was thanks for the comment🙂🙂🙂
@urrahman196
@urrahman196 3 жыл бұрын
One more error to be noted in the coding you wrote- it should have been : arr[ i ] - arr[i - k] instead of arr[ k ] - arr[i - k] .
@reddygariabbai1952
@reddygariabbai1952 24 күн бұрын
yes
@TUSHARSHARMA-zr1fc
@TUSHARSHARMA-zr1fc 2 жыл бұрын
You explain so good, with no wastage of time.... Love ur videos❤
@VinodMuda
@VinodMuda 2 жыл бұрын
Hi Keerti, Nice explanation, but I think it is missing an edge case, what if nums[] is less than k, lets say nums.length = 3, whereas k = 5, in that case it will give ArrayOutOfBound Exception. My version of code, though I learned this concept from you :) static int maxMovingAvg(int[] nums, int k) { int i = 0; int result = 0; if (nums == null || nums.length == 0) return result; if (nums.length == 1) return nums[0]; if (nums.length < k) k = nums.length; while (i < k) { result += nums[i]; i++; } int maxResult = result; while (i < nums.length) { result += nums[i]; result -= nums[i - k]; maxResult = Math.max(maxResult, result); i++; } return maxResult; } public static void main(String[] args) { //int[] nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; //int[] nums = {1, 2, 3, 4}; //int[] nums = {1, 2, 3}; //int[] nums = {1, 2}; //int[] nums = {1}; //int[] nums = {}; int[] nums = null; int maxResult = maxMovingAvg(nums, 3); System.out.println(maxResult); }
@ayanroy8757
@ayanroy8757 3 жыл бұрын
best video on window sliding
@Setchuko
@Setchuko Жыл бұрын
mam ur explanation is too good
@pranjalsingh1287
@pranjalsingh1287 3 жыл бұрын
I subscribed to your channel after watching several videos on your channel. Your videos focus on core concepts of topic and not just the particular problem(which other youtubers do) due to which we get a good sense of where these concepts can applied. Keep posting such videos❤️
@rohandevaki4349
@rohandevaki4349 2 жыл бұрын
can you tell which videos are focusing on core concepts? even i have faced the same problem on other youtubers videos
@snehitvaddi
@snehitvaddi 4 жыл бұрын
Great explanation yar!! I could literally visualize everything by your hand gestures itself!! 👏👏👏
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you so much 😇
@hiteshgupta219
@hiteshgupta219 4 жыл бұрын
The sliding window technique is my favourite one. Great explanation though !!
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you!! 😇😇
@divakarr6743
@divakarr6743 3 жыл бұрын
I like the way you had explained this video because I was able to understand this completely, I do not see the continuation video for dynamic window size, Are you planning to upload it?
@jitendraraghuwanshi1365
@jitendraraghuwanshi1365 4 жыл бұрын
One of my favourite techniques for arrays ,btw a great video!
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thanks! 😊
@suryakantchavan7061
@suryakantchavan7061 4 жыл бұрын
Thank you nice one
@bhanuchirutha
@bhanuchirutha 4 жыл бұрын
I didn't see the warning at 10:12 and thinking how this code works
@krrishiyer1016
@krrishiyer1016 3 жыл бұрын
The video is very well explained and detailed. Great work.
@DevLife_in
@DevLife_in 4 жыл бұрын
It was a great video Mam, I loved it. I don't even know about you in my past but i loved it.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thanks Divyanshu 🙂
@chiranshuadik
@chiranshuadik 3 жыл бұрын
found an error... maybe? in your second loop, you are just taking diff of a[k] and a[k-i].. you need to include the maxsum as well.. otherwise the max() comparison won't make sense.. thoughts?
@pranavsingh1081
@pranavsingh1081 3 жыл бұрын
Very good explanation
@harshitakanal7411
@harshitakanal7411 3 жыл бұрын
I really love your way of teaching, keep going di! 😃
@KeertiPurswani
@KeertiPurswani 3 жыл бұрын
Thank you so much Harshita, means a lot to me ❤️
@rudraksh9635
@rudraksh9635 4 жыл бұрын
Oh gosh , this is much awaited !!! Thanx a lot ma'am .. want more such videos , two pointer approach ! Btw loved ur content ma'am , thank you ma'am
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
I have discussed little biy about the two pointer approach in the end. My next video will be on that completely 😊
@rudraksh9635
@rudraksh9635 4 жыл бұрын
@@KeertiPurswani sure maam , would be looking forward for the same , just increase ur content frequency by bit maam , if possible ..
@akshayar2383
@akshayar2383 3 жыл бұрын
@@KeertiPurswani Hi ma'am, when can we expect the two pointer approach video?
@sprajwal-lq3zz
@sprajwal-lq3zz Жыл бұрын
great explanation thanks.
@osvaldocarrillo1361
@osvaldocarrillo1361 2 жыл бұрын
Awesome, thank you!
@vivekjaiswar6825
@vivekjaiswar6825 3 жыл бұрын
I know it seems a little late but ur code is incorrect it should be currentSum += arr[i] - arr[i-k];
@tejaswi4650
@tejaswi4650 3 жыл бұрын
Hi di, could you able ot provide the link to solving a problem of variable window size?
@sreekanthjanapati409
@sreekanthjanapati409 3 жыл бұрын
Nice explanation
@himanshugupta7010
@himanshugupta7010 3 жыл бұрын
correct me if i wrong , but ig there at the loop k to n : you forgot to mention that we include the next element(after k elements )and excluded the first element i.e sliding the window .. you just did arr[i-k]-arr[k] which ig is not correct ... apart from this the concept explanation is fab..
@rydham8252
@rydham8252 3 жыл бұрын
Very well explained topic 👍👍.
@KeertiPurswani
@KeertiPurswani 3 жыл бұрын
Thank you! ❤️😇
@pawanagrawal7653
@pawanagrawal7653 4 жыл бұрын
Mam ur videos are very good, i have understood the concept very nicely.. Plss make a video on which covers all the algorithms like greedy, divide and conquer etc..and also attached some questions based on them...it will be very grateful.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Definitely! Many videos coming up 😇
@AgAnushree
@AgAnushree 3 жыл бұрын
There is a small error in the code you have written. In first line of second loop the code should be window_sum += arr[k] - arr[i-k]. You have written window_sum = arr[k] - arr[i-k]
@marketcrorepati5729
@marketcrorepati5729 3 жыл бұрын
correct I also got confused
@charansai1133
@charansai1133 2 жыл бұрын
yeah i too observed that
@aadarsh8839
@aadarsh8839 2 жыл бұрын
Shouldn't it be a[I] - a[i-k] ?? How we gonna slide if k is constant with a[k]-a[i-k] . Great explanation though , thanks
@ermahesh2009
@ermahesh2009 Жыл бұрын
any real use case?
@ashutoshkumar4267
@ashutoshkumar4267 4 жыл бұрын
Great explaination, Thanks
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thanks 😊
@debaduttapanda7816
@debaduttapanda7816 2 жыл бұрын
really helpful
@AritraBhattacharyya91
@AritraBhattacharyya91 3 жыл бұрын
Hi Keerti, Thanks for your awesome videos. Can you please create a dynamic programming concepts videos on how to identify and approach problems, find substructures etc. (if you already haven't).
@sonupunia
@sonupunia 4 жыл бұрын
Hey Keerti your videos are very detailed and still easy to understand. Just watched few of ur videos and they were awesome. My fav is BFS and DFS detailed video.Can u suggest some reading resources that will help. Thanks a lot :)
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you so much Sonu. Means a lot. I have generally read from gfg, cracking the coding Interview by Gayle Lakman and Karumanchi 😇
@jatinmalhotra2117
@jatinmalhotra2117 4 жыл бұрын
very good explanation ! 👍
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you 😇
@ishaankulkarni49
@ishaankulkarni49 2 жыл бұрын
very helpful!
@vjkumk
@vjkumk 2 жыл бұрын
wondering why 2 for loops are needed when it can be done by 1 while loop as below. here is the python solution. arr=[1,2,4,3,2 1,5] maxsubarray=[] maxsum = 0 k =3 i=0 while (i < len(arr) -1 and ( i + k)
@arukshasilvie
@arukshasilvie 2 жыл бұрын
Hello, your videos are awesome, can you please explain monotonic stack/queue questions too ?
@ranitdey7369
@ranitdey7369 4 жыл бұрын
Your way of explaining the concepts is fabulous. keep it up!
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thank you. Means a lot! 😇😇
@suyashmisra7406
@suyashmisra7406 4 жыл бұрын
Dear Ma'am,Thanks a lot for these tutorials. They are really helpful. I have a request ,if you don't mind. I'd love it if you could share some guidance on "off campus" placements,regarding anything "extra" that one must keep in mind while applying off campus. Since I have no experience of it,any help will be appreciated. Thanks in advance!
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Was planning this already after few videos 😊
@suyashmisra7406
@suyashmisra7406 4 жыл бұрын
@@KeertiPurswani Really appreciate it. Can't wait!
@rakshithd4942
@rakshithd4942 3 жыл бұрын
0:00 to 0:02: Is that a way to say Hi using the sliding window approach? 😂
@aryankhurana1847
@aryankhurana1847 4 жыл бұрын
Awesome!
@ishankumarsethi8773
@ishankumarsethi8773 4 жыл бұрын
Mam please explain more on two pointer approach in your next videos.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
For sure! Going to make a video on this!
@deeyasings
@deeyasings 2 жыл бұрын
Helpful
@aravind8731
@aravind8731 2 жыл бұрын
Hello mam, you had mistake on 9.42 it's arr[ i ] is not an arr[ k ] when you teaching it was right but you wrote accidentally wrong.
@pokiripkr
@pokiripkr 3 жыл бұрын
I like the way u say hi and I like ur voice
@amolmohadikar6716
@amolmohadikar6716 2 жыл бұрын
code is wrong it should be wind_sum += arr[i] -arr[i-k];
@vishalmittalvishalmittal
@vishalmittalvishalmittal 3 жыл бұрын
Time Complexity of Naive approach should be O(N-K)*K
@venkatkuncham2332
@venkatkuncham2332 4 жыл бұрын
Try with a gud mic,ur channel will go upto 1lakh subscribers easily (hoping to reach 1m😁),I like the way you explain.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Thanks @Venkat!! 😇
@LeadCode1
@LeadCode1 3 жыл бұрын
Aapko react aati h kya?
@aayush5474
@aayush5474 4 жыл бұрын
Your explanation reminds me of aditya verma :)
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
That's a compliment!! He has another level fan following 😊
@theexposerprint7574
@theexposerprint7574 4 жыл бұрын
this code seems incorrect to me.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
Hi, how is that? Could you please share more?
@theexposerprint7574
@theexposerprint7574 4 жыл бұрын
@@KeertiPurswani it's fine. you explained it very well.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
@@theexposerprint7574 thanks 🙂
@theexposerprint7574
@theexposerprint7574 4 жыл бұрын
@@KeertiPurswani going to watch all of your videos. will let you know if i find any issue.
@KeertiPurswani
@KeertiPurswani 4 жыл бұрын
@@theexposerprint7574 awesome 😇🙂
@shaikfahim1232
@shaikfahim1232 3 жыл бұрын
Didi aap bhi Adithya Verma bhayya ki tarah yek concept ko pakdo aur Usko detail me samjhado Koi notice kia hai kya Adithya Verma bhayya ki channel ke subscribers tho another level pe increase ho rahe hain Aur subscribers chahte hon to aap ka bhi kaam nikal jaayega
@silverbullet_6
@silverbullet_6 2 жыл бұрын
better than most of the trash on Yt
@FinanceMode14
@FinanceMode14 2 жыл бұрын
NIce
@shrenikpatodi4854
@shrenikpatodi4854 4 жыл бұрын
👍
@MsBlueshark
@MsBlueshark Жыл бұрын
This didn't turn out that well
@prototypebharrat
@prototypebharrat 5 ай бұрын
Out of topic but You have changed so much after marriage
@santoshjaishi3
@santoshjaishi3 4 жыл бұрын
Tumme bahut jyada adss lagaya he.
@FitLoki
@FitLoki Жыл бұрын
Nice explanation mam ....you explained it from the scratch itself ,this is the first video I am watching in this channel and am impressed and subscribed as well... keep doing on this topics
Sliding Window Technique + 4 Questions - Algorithms
27:25
QuanticDev
Рет қаралды 130 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
L16. Sliding Window Maximum | Stack and Queue Playlist
19:58
take U forward
Рет қаралды 45 М.
Tips that worked for me during Interview Preparation 🌟
23:06
Keerti Purswani
Рет қаралды 10 М.
JavaScript Sliding Window Technique - Fixed Size
15:19
The Code Creative
Рет қаралды 15 М.
Sliding Window Technique | Google Coding Interview | Maximum Size SubArray Of Size K
16:06
JAVAAID - Coding Interview Preparation
Рет қаралды 67 М.
how to study less and get higher grades
11:16
Gohar Khan
Рет қаралды 2 МЛН
How to Remember Everything You Read
26:12
Justin Sung
Рет қаралды 3,2 МЛН
Think Fast, Talk Smart: Communication Techniques
58:20
Stanford Graduate School of Business
Рет қаралды 44 МЛН
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 767 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН