Sliding Window pattern

Minimum Window Substring

Given strings s and t, return the smallest substring of s that contains every character of t, counting multiplicity. If no such window exists, return the empty string. Watch it run step by step, then write your own pseudocode and get it checked by AI.

  • LeetCode 76
  • Hard
  • 1 approach

Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.

Sliding WindowLeetCode 76

Hard

The approach

  1. 01 Expand + contract window O(|s| + |t|)O(|t|) space
Played step by step, with its time and space.

What you will learn

  • How to read Minimum Window Substring and spot the sliding window pattern in it
  • Expand + contract window: O(|s| + |t|) time, O(|t|) space
  • The pseudocode for each approach, its line lit as the animation runs
  • Practice: write your own pseudocode and get it checked

More Sliding Window

See Minimum Window Substring run, step by step

Sign in and this page opens on the animation, with all 8 Sliding Window problems beside it.

DSA comes with the all labs plan and every ChaiCode batch.