Back to problems

Minimum Window Substring

Algorithm · Lyft · Medium

Requirements Given two strings s and t, find the shortest contiguous substring of s that contains every character from t, including duplicates. Character frequencies matter: if t has two copies of 'a', the window you return must contain at least two 'a's. If no window in s covers all characters of t, return an empty string "". This is the classic formulation from LC 76; be prepared to describe the invariant that makes a window valid and to explain how you move the left and…

Checking your access…