Use a sliding window that expands until it covers all required characters, then shrinks to minimal.
Maintain a frequency map need for t and a missing counter for how many required characters are still unmet. Expand r to satisfy requirements, then shrink l while keeping the window valid.
Every time the window becomes valid, shrinking from the left finds the smallest valid window ending at r. The global best over all r is the answer.
Use a sliding window that expands until it covers all required characters, then shrinks to minimal.
Maintain a frequency map need for t and a missing counter for how many required characters are still unmet. Expand r to satisfy requirements, then shrink l while keeping the window valid.
Every time the window becomes valid, shrinking from the left finds the smallest valid window ending at r. The global best over all r is the answer.