Sliding Window LeetCode 1493, 1004, 487, 485 - Interview Prep 82

Опубликовано: 18 Май 2026
на канале: Fisher Coder
10,028
293

⭐ Shop on Amazon to support me: https://www.amazon.com/?tag=fishercod...
⭐ NordVPN to protect your online privacy: https://go.nordvpn.net/aff_c?offer_id...
⭐ NordPass to help manage all of your passwords: https://go.nordpass.io/aff_c?offer_id...

In this video, we go through a very classic and useful sliding window approach that could come in handy in lots of LeetCode/Interview problems, we can almost use identical code to solve these four problems on LeetCode:

1. https://leetcode.com/problems/longest...
2. https://leetcode.com/problems/max-con...
3. https://leetcode.com/problems/max-con...
4. https://leetcode.com/problems/max-con...

⭐ Support my channel and connect with me:
   / @fishercoder  

Algorithm explained:
We use two pointers: i and j to maintain a sliding window in which only up to K zeroes are allowed, while j advances through the end of the array, we update the max length possible that meets the requirements.

// TOOLS THAT I USE:
○ Memory Foam Set Keyboard Wrist Rest Pad - https://amzn.to/3cOGOAj
○ Electric Height Adjustable Standing Desk - https://amzn.to/2S9YexJ
○ Apple Magic Keyboard (Wireless, Rechargable) - https://amzn.to/36gy5FJ
○ Apple Magic Trackpad 2 (Wireless, Rechargable) - https://amzn.to/36ltimu
○ Apple MacBook Pro - https://amzn.to/30iSvKE
○ All-In One Printer - https://amzn.to/34etmSi
○ Apple AirPods Pro - https://amzn.to/2GpVYQf
○ My new favorite Apple Watch - https://amzn.to/2EIIUFd

// MY FAVORITE BOOKS:
○ Introduction to Algorithms - https://amzn.to/36hxHXD
○ Designing Data-Intensive Applications - https://amzn.to/2S7snOg
○ Head First Java - https://amzn.to/2ScLDKa
○ Design Patterns - https://amzn.to/2SaGeU2


Read it on my site: http://fishercoder.com/blog/post/slid...

Follow me on Github for complete LeetCode solutions: https://github.com/fishercoder1534/Le...

Support me on Patreon:   / fishercoder  

My ENTIRE Programming Equipment and Computer Science Bookshelf:
https://www.amazon.com/shop/fishercoder


And make sure you subscribe to my channel!

Your comments/thoughts/questions/advice will be greatly appreciated!

#Kahnsalgorithm #graphsearch #topologicalsorting #softwareengineering #leetcode #algorithms #coding #interview #SDE #SWE #SiliconValley #programming #datastructures