Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

LeetCode-Style Questions

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

Your question is LeetCode-Style Questions. 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

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):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output