Agreed! These are great. More "Algorithmic Mental Models" for dynamic programming, backtracking, etc. would be extremely helpful. Thanks for the video!
I've never before seen a CS video that approached CS like math (i.e., here are the concepts, here are some keywords to look out for so you know when to apply these concepts, here are a few examples). The world needs 1,000 more videos like this (DP, Linked Lists, Trees, Graphs, etc). Fantastic work!
Who even has the audacity to dislike such a video?? The best and simplest explanation of sliding window concept i have ever come across. Thank you sir!
Max subarray sum of k is also a dynamic programming problem. You reuse the previous max result and update it. So it is like dynamic programming with space complexity O(1).
I came across this video after struggling with sliding window problems in preparation for my upcoming Google interview, and just wanted to thank you for the super clear explanation. I'm feeling much more confident with these problems now. 👍
Was struggling a lot with sliding window problems earlier, your explanation really simplified those problems. I really appreciate your effort. Thank you! Please post more videos.
I have always been calculating the first windowSum in a separate loop before starting to "move" the window in a separate loop. I never knew you could do both within the same loop without using a nested loop. This is amazing!
Great explanation! I'm a visual learner and I can see myself imagining these sliding window animations when I face array problems like this in the future.
You might be a professor or a normal student, but your explanation skills are exceptional. Add to that most of the videos explaining algorithms do not include such an amazing visualization for the data structures that we are working with. I hope one day you will have the free time to make a full algorithms and data structures for competitive programming course with such an amazing visualization. Hope you the best sir whereever you are.
I looked into it and looks like this "Algorithmic mental models" video is the most viewed video on your channel. Upon reading the comments, people seems to really love it and are asking more of it covering other topics. Genuinely curious, why didn't you make more of this type of vide, that clearly seems to be the most viewed one on your channel?
I have struggled with this concept for a really long time, but not anymore :) Your explanations were absolutely beautiful and I'm excited to solve some sliding window problems now! Can you please create more Algorithmic Mental Model videos? We'd all be super grateful!
After watching this one, I could solve even the hard LC problems within 15-20 mins. This is a gem of a video on this topic. Hope you make more of these on other topics, I will literally pay for it
This is the best video I've ever seen on this topic "sliding window"! It does not only solve one or two interview questions for me but also solves a group of problems. More than that, it teaches me how to spot this group of problems. Fantastic!!!
This is fantastic! Please make more of these 'mental model' videos. There too many videos out there that jump straight to the solution without any discussion of how to approach and generalize a problem. We need more video's like this!
What an excellent, well paced, well explained video with explaining the theory but also showing it in examples THANK YOU! The more you research the more you come to understand that trying to solve all these problems individually with out knowing about techniques like these, is so painful lol
Thank you @Ryan Schachte for clarifying the sliding window technique and make it so simple just like that. I hope you upload a lot more vids like this bro !
dude I am only 2 minutes in and I've liked and subscribed! Between the visuals and your consice explanations, the sliding window technique (which I never thought I'd understand) makes SO MUCH SENSE! Thanks so much :)
This is such an awesome video by abstracting the idea of sliding window to tackle a group of specific issues with similarities. Regarding the question of smallest subarray for a given target, I think we need to add the constraint that every element in the array is positive. Otherwise, the sum can be reduced even if we grow the size of the window without dropping the front one. 28:37
31:11 The reason you "add 1" isn't because the array is indexed at 0. It's because the start element gets subtracted and it needs to be added back. Thank you for making the video :)
@Ryan : In case of smallestSubarray method, if targetSum is 9, it is failing, need to add another condition in it. private static int smallestSubarray(int targetSum, int[] input) { int currentWindowSum = 0; int minWindowSize = Integer.MAX_VALUE; int windowStart = 0; for (int windowEnd = 0; windowEnd < input.length; windowEnd++) { currentWindowSum += input[windowEnd]; while (currentWindowSum >= targetSum && windowEnd > windowStart ) { minWindowSize = Math.min(minWindowSize, windowEnd - windowStart + 1); currentWindowSum -= input[windowStart]; windowStart++; } } return minWindowSize; }
OMG, Best problem solving explanation I've ever seen. it is a really helpful, simple, and to the point, Thank you for this extraordinary video. Liked and subscribed 🙌
@@TheSimpleEngineer Like the ones in "Grokking the Coding Interview: Patterns for Coding Questions". You explained this to me so well. Would be dope if you did that for patterns from that list. i like your teaching style my friend. I would pay money if you had a course explaining those.
@@TheSimpleEngineer Hi, Ryan. Hope you can clear something up for me. The solution for smallestSubArray isn't O(n^2) because you aren't looping over the array in the while loop, correct? You're just looping until the condition is no longer true. Is that right, or am I totally off?
Incredibly simple explanation. I felt like a baby being handed his lego building blocks. I absolutely learnt a hitherto abstract concept, i will never forget.
this was such a good explanation !! I hate Java but through your explanation I was able to understand what each line of code was doing. Even pointing out certain words that give away how one should solve the problem. Looking forward to future algo breakdowns !
Same! I know this is an old comment, but I was able to mentally translate this into the programming languages I do know algorithms in. This is a great video.
for python lovers on the first question cur = 0 _max = cur t = [4,2,1,7] for i in range(len(t)): cur = sum(t[i:i+3]) if cur > _max: _max = cur else: cur = cur print(_max)
This video just came up in my recs as I'm interview prepping and I'm so mad this is your only video like it! I thought I hit a goldmine for interview prep for a sec LOL, but nonetheless this video is amazing. Thank you so much
Wow I was amused by your teaching it all went straight into the head. Somehow RU-vid algorithm suggested this gem 💎 . The fact that this video was made 4 years ago great content bro 🎉 🥳.Would be great if you make some more 'mental model' videos thank you, stay in good health ❤