Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Minimum Window Substring Match

HardPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Minimum Window Substring Match. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Given two strings s and t, return the shortest substring of s that contains every character in t, including duplicates. If no such substring exists, return an empty string. The input is two strings, and the output is a string.

Constraints

  • 1 <= len(s) <= 10^5
  • 1 <= len(t) <= 10^5
  • s and t consist of English letters
  • Duplicates in t must be matched in the window

Function Signature

def min_window(s, t):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output