DevHireLab
TutorialsBootcamp
Problems
Code SimulatorAI InterviewSoonContact
DevHireLab
TutorialsBootcamp
Problems
Code SimulatorAI InterviewSoonContact
Back to Arena
hard
Sliding Window

Minimum Window Substring

**Problem Statement:** Given two strings `s` and `t` of lengths `m` and `n` respectively, return the minimum window substring of `s` such that every character in `t` (including duplicates) is included in the window. If there is no such substring, return the empty string `""`. **Hint / Expected Approach:** Two pointers + frequency map + formed counter **Edge Cases to Consider:** - (1) t longer than s - (2) t has duplicate characters - (3) Exact match (s equals t)

Examples

Example 1
Input: "ADOBECODEBANC", "ABC"
Output: "BANC"
Example 2
Input: "a", "a"
Output: "a"
Example 3
Input: "a", "aa"
Output: ""

Constraints

  • ▪1 <= data.length <= 10^5
  • ▪Memory complexity must be O(1) or O(k)
  • ▪Ensure non-overlapping pointer access

Watch Out For Edge Cases

  • ▪t longer than s
  • ▪t has duplicate characters
  • ▪Exact match (s equals t)
Frequently Asked At
GoogleAmazonMicrosoftMetaAdobe