FastPrepMinimum Covering Substring
Problems/Minimum Covering Substring

Minimum Covering Substring

ByteDance logoByteDance● HardFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The original report describes sliding-window updates that count repeated letters, and it talks about listing the starts of all the shortest windows. To get one fixed answer, our version returns the leftmost shortest covering substring, and an empty string when there is none.

Given strings s and t, return the shortest contiguous substring of s that contains every character of t with at least its required multiplicity.

  • Character matching is case-sensitive.
  • If several covering substrings have minimum length, return the leftmost one.
  • Return the empty string when no covering substring exists.

Function

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

Examples

Example 1

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

BANC is the shortest substring containing A, B, and C.

Example 2

s = "aaabcbcba"t = "aabc"return = "aabc"

The substring from index 1 through 4 contains two a characters plus b and c; no shorter window can satisfy four required characters.

Constraints

  • 0 <= s.length, t.length <= 100000.
  • s and t contain case-sensitive ASCII characters.

More ByteDance Onsite Interview questions

  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Largest Rectangle in HistogramPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Reverse Linked ListPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Search a Row- and Column-Sorted MatrixONSITE INTERVIEW · Seen Nov 2026
  • Alien DictionaryPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lexicographically Smallest Topological OrderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Implement Multi-Head AttentionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dynamic Median with Additions and DeletionsONSITE INTERVIEW · Seen Oct 2026
  • Serialize and Deserialize a String Key-Value StoreONSITE INTERVIEW · Seen Oct 2026
  • Binary Tree Maximum Path SumONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Minimum Window SubstringAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Minimum Window SubstringLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Minimum Window SubstringMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Minimum Window SubstringGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
  • Minimum Window SubstringHighspot · ONSITE INTERVIEW
  • Longest Substring with At Most K Distinct CharactersAmazon Web Services · ONSITE INTERVIEWAmazon Web Services 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

ByteDance interview experiences

  • ByteDance TikTok USDS SWE Intern Interview: 1 Experience
  • ByteDance MLE New Grad Interviews: 1 Experience
  • ByteDance Security SRE Intern Phone Screens: 1 Experience
  • ByteDance USDS New Grad SWE Phone Screen: 1 Experience
  • ByteDance New Grad Data Engineer Video Interviews: 1 Experience
  • ByteDance Trust & Safety Research Scientist Intern: 1 Experience
All ByteDance interview questionsSee ByteDance hiring insights
Saved
class Solution {
    public String minCoveringSubstring(String s, String t) {
        // TODO: return the leftmost shortest covering substring.
    }
}
Checking account…