← Practice · Sliding window

Minimum Window Substring Hard

Given strings s and t, return the shortest substring of s that contains every character of t (with multiplicity). If none exists return "". The answer is unique when it exists.

Examples

  • s = "ADOBECODEBANC", t = "ABC" -> "BANC"
  • s = "a", t = "aa" -> ""

Define a function named minWindow in JavaScript.

00:00

JavaScript · Tab indents · Ctrl/⌘+Enter runs the tests