JavaScript Sliding Window Technique - Fixed Size
HTML-код
- Опубликовано: 20 авг 2024
- The Sliding Window technique - a classic technique for solving many algorithm challenges involving subarrays and substrings. With the sliding window technique, we can achieve a linear runtime complexity of O(n). In particular, I demonstrate the fixed variant of the sliding window technique using JavaScript. Created by Gregg Fine.
Download my FREE "Google Search Secrets for Developers" Cheat Sheet:
store.thecodec...
🗣JOIN the Code Creative Facebook group! :
/ 1612600368887577
🔴Subscribe for more free Code Creative videos: : / @thecodecreative
🌐 The Code Creative Official Website
www.thecodecre...
🎓 The Code Creative Courses
www.thecodecre...
✅ Recommended related videos:
Debouncing Explained
• Debouncing Explained |...
Memoization Explained
• JavaScript Memoization...
Sorting in JavaScript Explained
• JavaScript Comparator ...
✅ For business inquiries contact me at gregg@greggfinedev.com
✅ Let's connect:
Twitter - @GreggFine
Instagram - /greggfinedev
Facebook - /hiddentigermusic
To subscribe to the channel: ruclips.net/channel/UCmOpHGj4JRWCdXhllVTZCVw
Just found you, this is 👍 thanks for the video
@@handsanitizer2457 Great, thanks for watching!
This is undoubtedly the best explanation for a tutorial on algorithms I have seen on RUclips. I look forward to receiving more notifications to watch more tutorials from this channel. You are amazing with your way of explanation. Thank you!
Glad it was helpful!
I've researched good explanation for this technique. Your version is the best. Thanks for your videos.
Glad it was helpful!
this is the best way someone explained the technique and the actual code
Excellent! 👍🏻
the brute force approach is not quadratic, but it is O(nm), where m is the fixed window size and n is the number of elements in the array. If you assume that m
even when m is close to n, it is not quadratic as the number of iterations drops significantly, so it is closer to linear time.
Videos are better for learning than reading online. I have read and read about this and couldn’t understand anything. But your video makes it clear to me
👍🏻👍🏻👍🏻
first time i saw sliding window it looked like a hard code to understand, but bro you just demystified it
Glad to hear!
The way you explain this algorithm is just incredible
Thank you and thanks for watching!
Hi sir .. these algorithms and the way you explain them are amazing . please don't stop .. these are the best in youtube.
Hi Dheeraj, thanks for the kind words. More videos coming soon. Thanks for watching!
Thank you for this. Been struggling to grasp the concept of coding it.
The "aha" was when I realized that [i] will ALWAYS be bigger than [size -1] once you have your first "true" sum of numbers.
Subscribed and watching. Thanks again!
Glad it helped!
You explained this so eloquently and now I have a clear understanding of this method. Thank you.
Glad it was helpful!
Best algorithm explanation that i ever found!
Glad it helped!
🗣JOIN the Code Creative Facebook group! :
facebook.com/groups/1612600368887577
wow! This is the best video on the sliding window pattern. Your explanation is top notch and animations and audio quality are outstanding. Please do more videos on other patterns like Two Pointers and Fast and Slow pointers. Keep up the great work!
Glad it was helpful!
Excellent Explanation Sir. Thank you very much.
You are most welcome
golden content, needs to be at 1 million+ views really...
Thank you! Only about 992,000 left to go 😀
📖 Download my FREE "Google Search Secrets for Developers" Cheat Sheet:
store.thecodecreative.com/google-secrets-cheat-sheet
You the man. Thank you
👍🏻👍🏻👍🏻
Your voice and the calm clear explanation really helped me understand this technique. Subscribed and liked!
That's great to hear! Thanks for watching 👍🏻
The video presentation and transition of the window over array and you method was awsome
Glad to hear! Thanks for watching!
I loled at 4:05 Nice videos!
🤣🤣🤣 thanks!
Amazing video, thank you
Glad you liked it!
This is really helpful. Thank you
Glad it was helpful!
Excellent video!
Thanks for watching Alexander!
Thank you mate!
You're welcome!
love the MDN screenshots and the voice is great. Subbed.
Great, thank you!
Enjoyed your teaching.
Very grateful to you man...
Thank you and thanks for watching!
Wowww. Thanks a million 😁 😁 😁
You're welcome!
Great explanation with Clarity 👍
Thanks Vinoth!
Excellent explanation! Thank you.
Thanks for watching!
Good Explanation
👍🏻👍🏻👍🏻
keep it up 👌👌👌 great videos with great values thanks i hope your channel grow fast
Thank you!
Good explaination.
Thanks for watching!
Awesome Greg 👍🏽👍🏽👍🏽
Thanks Arun!
THANK YOU KEEP UP GOOD WORK I WAS STRUGGLING WITH SLIDING WINDOWS. Do you have a dynamic sliding window video ????
Thanks! No dynamic sliding window yet, but stay tuned!
great explanation
Glad it was helpful!
Awesome!
Hey Zameer Sheikh, thanks for watching!
Hi, thanks so much for the clear explanation found it very insightful.
I would like to know other algorithmic techniques one should know because this is my first time hearing about this concept. Hence, am very curious about other concepts like the sliding window technique
First of all, thank you for the tutorial! It's very well-paced and easy to follow.
However, I have a question regarding subtracting the number once i gets to >= size. On line 9, we do this:
`currSum -= nums[i - (size-1)];`
Is it correct, though? Let's say, our i is 3, which means that we have to "move" the window, remove the first element and start calculating from the second element in the array. In that case, we should subtract nums[0], which is nums[i - size] (= nums[3-3]). If we subtract nums[3 - (3-1)], we end up subtracting nums[1], which is incorrect, isn't it?
thanks for this, would be good to do a nested for loop so we could compare it with the optimised solution, just a thought, thanks.
please bring a dsa algoritm interview prep series in js
Great idea!
anyone else here for advent of code?
💯✨
Thanks!
i guess the cat have a hard time understanding the sliding window algos.
🗣JOIN the Code Creative Facebook group! :
facebook.com/groups/1612600368887577