FastPrepMinimum Window Substring
Problems/Minimum Window Substring

Minimum Window Substring

Highspot logoHighspot● HardFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand report from a Highspot senior software engineer links straight to the well-known Minimum Window Substring problem. It was asked in an onsite interview. Our version is about 99% the same as the reported question.

Given strings s and t, find the shortest contiguous part of s that contains every character of t with its required multiplicity. Return that part of s. If no part qualifies, return an empty string.

For these test cases, a shortest qualifying window, when one exists, is unique. Treat uppercase and lowercase letters as different characters.

Function

minWindow(s: String, t: String) → String

Examples

Example 1

s = "ADOBECODEBANC"t = "ABC"return = "BANC"

The final four characters contain each required letter; no shorter window does.

Example 2

s = "a"t = "a"return = "a"

The only character supplies the target.

Example 3

s = "a"t = "aa"return = ""

There is only one copy of a, so no valid window exists.

Constraints

  • 1 ≤ s.length, t.length ≤ 10^5.
  • Both strings contain only uppercase and lowercase English letters.
  • The total input fits in memory.

More Highspot Onsite Interview questions

  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Aug 2024
  • Number of IslandsONSITE INTERVIEW · Seen Aug 2024

Similar questions at other companies

  • Minimum Window SubstringAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Minimum Window SubstringLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Minimum Covering SubstringByteDance · ONSITE INTERVIEWByteDance interview questions
  • Minimum Window SubstringMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Minimum Window SubstringGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
  • Longest Substring Without Repeating CharactersOracle · ONSITE INTERVIEWOracle interview questions
  • Longest Substring Without Repeating CharactersSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Longest Substring Without Repeating CharactersGoogle · ONSITE INTERVIEWGoogle interview questions
  • Longest Substring Without Repeating CharactersInfosys · ONSITE INTERVIEWInfosys interview questions
  • Longest Substring Without Repeating CharactersOmnissa · ONSITE INTERVIEWOmnissa interview questions
See Highspot hiring insights
Saved
class Solution {
    public String minWindow(String s, String t) {
        // Write your code here.
    }
}
Checking account…