FastPrepMinimum Window Substring
Problems/Minimum Window Substring

Minimum Window Substring

Salesforce logoSalesforce● HardFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The candidate did not remember the exact question. They described it as sliding window plus a hash map, along the lines of Minimum Window Substring.

The report gives no rules, examples, or limits. It does not say whether or how the real question differed from Minimum Window Substring. Here, you solve the usual Minimum Window Substring task. Repeated letters in t all count, and upper and lower case are different. A tie goes to the window that starts first. If no window is valid, you return an empty string.

Our version is about 70% the same as the reported question.

You are given two strings, s and t. Return the shortest contiguous substring of s that contains every character of t, counting repeats. For example, if t has two a characters, the substring must have at least two a characters.

Uppercase and lowercase letters are different characters. If several shortest substrings qualify, return the one that starts first. If no substring qualifies, return an empty string.

Function

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

Examples

Example 1

s = "DAEBFCAB"t = "ABC"return = "CAB"

Three substrings hold A, B and C without any spare letters at the edges: "AEBFC", "BFCA" and "CAB". The shortest is "CAB", with length 3.

Example 2

s = "baacaba"t = "aab"return = "baa"

t needs two a and one b. Both "baa" (starting at index 0) and "aba" (starting at index 4) qualify and have length 3. "baa" starts first, so it is the answer.

Example 3

s = "aAbB"t = "aa"return = ""

t needs two lowercase a, but s has only one. The uppercase A is a different letter, so no substring qualifies.

Example 4

s = "q"t = "q"return = "q"

The whole string is the only substring, and it holds the one letter t needs.

Constraints

  • 1 <= s.length <= 5 * 10^4
  • 1 <= t.length <= 5 * 10^4
  • s and t contain only English letters.

More Salesforce Phone Screen questions

  • Detect a Cycle in a Linked ListPHONE SCREEN · Seen Oct 2026
  • Find Rows Common to Two TablesPHONE SCREEN · Seen Oct 2026
  • Merge Two Sorted Linked ListsPHONE SCREEN · Seen Oct 2026
  • Minimum Window of Required WordsPHONE SCREEN · Seen Aug 2026
  • Permutations of Unique CharactersPHONE SCREEN · Seen Aug 2026
  • Optimal Account BalancingPHONE SCREEN · Seen Jul 2026
  • Longest Increasing SubsequencePHONE SCREEN · Seen Jul 2026
  • Maximal SquarePHONE SCREEN · Seen Jul 2026
  • ATM Queue Exit OrderPHONE SCREEN · Seen May 2026
  • Good Ways to Split an ArrayPHONE SCREEN · Seen May 2026

Similar questions at other companies

  • Minimum Window SubstringLyft · PHONE SCREENLyft interview questions
  • Minimum Window SubstringAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Minimum Window SubstringCharacter.AI · PHONE SCREEN
  • Shortest Window Covering All LettersAdobe · PHONE SCREENAdobe interview questions
  • Minimum Window SubstringWhatNot · PHONE SCREENWhatNot interview questions
  • Minimum Window SubstringSambaNova Systems · PHONE SCREENSambaNova Systems 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

Salesforce interview experiences

  • Salesforce Infrastructure SWE OA and Onsite: 1 Experience
  • Salesforce Experienced Backend SWE First Round: 1 Experience
All Salesforce interview questionsSee Salesforce hiring insights
Saved
class Solution {
    public String minWindow(String s, String t) {
        // Write your code here.
    }
}
Checking account…