Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
LeetCode-Style Questions
00:00
5 left

LeetCode-Style Questions

HardPython

Problem

Agoda Search processes user-entered destination and property queries. Given a text string s and a pattern t, find the shortest contiguous substring of s that contains every character in t, including repeated characters.

Characters are case-sensitive. If multiple shortest substrings exist, return any one. If no valid substring exists, return an empty string.

Formal Specification

  • Input: Two strings, s and t.
  • Output: A string containing the minimum-length contiguous portion of s whose character counts cover all character counts in t.
  • The function must not reorder characters or select non-contiguous positions.

Constraints

  • 1 <= len(s), len(t) <= 10^5
  • s and t contain uppercase and lowercase English letters
  • Character matching is case-sensitive
  • Return an empty string when no valid window exists

Function Signature

def min_query_window(s, t):
Interviewer

Your question is LeetCode-Style Questions. Start with the requirements in the Question tab.

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.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.