This is the biggest shift in the entire sliding window series. Every problem in Parts 1–4 had a fixed window size. You were always told: look at every subarray of size k. The window slid one step at a time — add one element, remove one element — like clockwork. The challenge was in what READ MORE
Month: March 2026
Sliding Window Pattern – Part 4: When the Window Gets Smarter
In Parts 1–3, every sliding window problem followed a single template: you were given a window size k, you maintained a running sum or count, and you slid one step at a time. The only variation was the evaluation logic — track the max, count matches, or maintain a monotonic deque. The window itself was READ MORE
Sliding Window Pattern – Part 3: The Monotonic Deque
In Part 1 and Part 2, every problem had a clean O(1) update per window slide — add an element, remove an element, done. That worked because we were tracking sums or counts, which are trivially updatable. But what if you need the maximum of each window? You can’t just subtract the outgoing element from READ MORE
Sliding Window Pattern – Part 2: Variations with Conditions
In Part 1, we covered the core fixed-size sliding window pattern: maintain a running sum, slide one element at a time, evaluate each window in O(1). The three problems we solved were almost identical in structure. Now things get more interesting. The four problems in this post still use a fixed-size window, but each one READ MORE
Sliding Window Pattern – Part 1: The Core Pattern and Basic Problems
If you’re preparing for coding interviews or just want to sharpen your algorithm skills, the sliding window technique is one of the most important patterns to master. It shows up everywhere — from easy warm-ups to hard interview favorites — and once you see the pattern, you’ll recognize it instantly. In this 3-part series, I’ll READ MORE
Priority Queues & Binary Heaps Explained: How They Work Under the Hood
Imagine a hospital emergency room. Patients don’t get seen in the order they arrived — they get seen based on the severity of their condition. A patient with a heart attack jumps ahead of someone with a sprained ankle, regardless of who checked in first. That’s exactly the problem a priority queue solves in software. READ MORE
Tree Data Structures Explained: Binary Trees, BSTs & Tree Traversals
Arrays and hash tables are great for storing flat collections of data. But what about data that’s naturally hierarchical — like a company org chart, a file system, or the rules in a decision-making process? That’s where trees come in. Trees are one of the most widely used data structures in computer science, and a READ MORE
Hash Tables Explained: How Hashmaps Work Under the Hood
If you’ve ever used a dictionary in Python, an object in JavaScript, or an unordered_map in C++, you’ve already used a hash table. It’s one of the most important data structures in programming — and once you understand how it works internally, a lot of things in software development start to click. In this post, READ MORE