FastPrepMinimum Window Substring
Problems/Minimum Window Substring

Minimum Window Substring

SambaNova Systems logoSambaNova Systems● HardNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand SambaNova phone interview report dated June 9, 2022 clearly describes the well-known Minimum Window Substring problem.

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 SambaNova Systems Phone Screen questions

  • Deterministic Zigzag SortPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2022
  • Number of ProvincesPHONE SCREEN · Seen Jun 2022
  • Merge Three Sorted ArraysPHONE SCREEN · Seen Jun 2022
  • Task Scheduler with CooldownPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2022
  • Point Inside a TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2022
  • Parse Variable, Expression, and Application TreesPHONE SCREEN · ONSITE INTERVIEW · Seen Mar 2022
  • Decode StringPHONE SCREEN · Seen Mar 2022
  • Insert, Delete, and Get Random in Constant TimePHONE SCREEN · Seen Mar 2022
  • Ugly NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Apr 2021
  • Diagonal TraversePHONE SCREEN · Seen Nov 2020

Similar questions at other companies

  • Minimum Window SubstringLyft · PHONE SCREENLyft interview questions
  • Minimum Window SubstringAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Minimum Window SubstringSalesforce · PHONE SCREENSalesforce interview questions
  • Minimum Window SubstringCharacter.AI · PHONE SCREEN
  • Shortest Window Covering All LettersAdobe · PHONE SCREENAdobe interview questions
  • Minimum Window SubstringWhatNot · PHONE SCREENWhatNot interview questions
  • Longest Substring Without Repeating CharactersAngel One · PHONE SCREEN
  • Longest Substring Without Repeating CharactersNykaa · PHONE SCREENNykaa interview questions
  • Longest Substring Without Repeating CharactersIBM · PHONE SCREENIBM interview questions
  • Longest Substring Without Repeating CharactersTikTok · PHONE SCREENTikTok interview questions
All SambaNova Systems interview questionsSee SambaNova Systems hiring insights
Saved
class Solution {
    public String minWindow(String s, String t) {
        // Write your code here.
    }
}
Checking account…