Variable Size Sliding Window | Longest Substring Without Repeating Characters | EP 03
In this video, we break down the Variable Size Sliding Window pattern — one of the most asked patterns in FAANG interviews. We solve LeetCode 3: Longest Substring Without Repeating Characters from scratch — starting with the obvious brute force, understanding exactly why it fails, and building up to the clean O(n) sliding window solution. By the end you'll understand: ✅ How the variable window expands and shrinks ✅ Why we use `while` instead of `if` (this trips people up) ✅ The reusable template you can apply to any variable window problem ✅ All edge cases you need to know for interviews ━━━━━━━━━━━━━━━━━━━━━━━━━━ 📌 SLIDING WINDOW SERIES ━━━━━━━━━━━━━━━━━━━━━━━━━━ EP 01 – What is a Sliding Window? → https://youtu.be/FSvTilwTT7k EP 02 – Fixed Size Window (Max Sum Subarray) → https://youtu.be/XbVmTNk7ivo EP 03 – Variable Size Window (Longest No-Repeat Substring) → YOU ARE HERE EP 04 – Minimum Window Substring (LeetCode Hard) → Coming Soon ━━━━━━━━━━━━━━━━━━━━━━━━━━ ⏱️ TIMESTAMPS ━━━━━━━━━━━━━━━━━━━━━━━━━━ 0:00 – Welcome + What we're solving today 1:59 – Fixed vs Variable window (what's different) 3:18 – Problem breakdown + examples 4:55 – Brute force approach (and why it's O(n³)) 7:00 – The key insight: shrink don't restart 9:31 – Brute force code walkthrough 10:17 – Step by step dry run 12:44 – Clean O(n) solution line by line 14:40 – Time & space complexity 16:02 – Edge cases (don't skip this) 18:07 – The reusable variable window template 19:18 – What's next: EP 04 20:08 – Outro ━━━━━━━━━━━━━━━━━━━━━━━━━━ 🔗 RESOURCES ━━━━━━━━━━━━━━━━━━━━━━━━━━ LeetCode Problem → https://leetcode.com/problems/longest-substring-without-repeating-characters/ ━━━━━━━━━━━━━━━━━━━━━━━━━━ If this helped you, like and subscribe — EP 04 (Minimum Window Substring) is coming next and it's the hard one. Drop a comment: what finally made it click for you?
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.