Optimal Algorithmic Approach
Two-pointer sliding window with frequency maps and a 'formed' count.
Core Invariants & Edge Cases
- Maintain frequency maps for T and the current window
- Expand right until all T chars are covered, then contract left
- Track 'formed' counter to know when all required chars are present