Dynamic Programming pattern

Minimum Window Subsequence

Given strings S and T, return the shortest contiguous substring of S that contains T as a subsequence. If there are several such windows of minimum length, return the one starting at the smallest index; if none exists, return an empty string. Watch it run step by step, then write your own pseudocode and get it checked by AI.

  • LeetCode 727
  • 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.

Dynamic ProgrammingLeetCode 727

Hard

The approach

  1. 01 Grid DP · carry the start index O(n·m)O(n·m) space
Played step by step, with its time and space.

What you will learn

  • How to read Minimum Window Subsequence and spot the dynamic programming pattern in it
  • Grid DP · carry the start index: O(n·m) time, O(n·m) space
  • The pseudocode for each approach, its line lit as the animation runs
  • Practice: write your own pseudocode and get it checked

More Dynamic Programming

See Minimum Window Subsequence run, step by step

Sign in and this page opens on the animation, with all 18 Dynamic Programming problems beside it.

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