PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates algorithmic problem-solving skills in string processing, focusing on managing character multiplicities and correctness when identifying constrained substrings.

  • Medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Find minimum covering substring

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Given two strings s and t, return the shortest contiguous substring of s that contains every character of t with at least the same multiplicities. If multiple answers exist, return any one of the shortest; if none exist, return an empty string. State and justify your algorithm, analyze time and space complexity, and implement the solution in your preferred language.

Quick Answer: This question evaluates algorithmic problem-solving skills in string processing, focusing on managing character multiplicities and correctness when identifying constrained substrings.

Return the shortest substring of s containing every character of t with multiplicity.

Constraints

  • Characters are case-sensitive

Examples

Input: ('ADOBECODEBANC', 'ABC')

Expected Output: 'BANC'

Explanation: Classic minimum window.

Input: ('a', 'aa')

Expected Output: ''

Explanation: Impossible.

Input: ('aa', 'aa')

Expected Output: 'aa'

Explanation: Whole string.

Input: ('bba', 'ab')

Expected Output: 'ba'

Explanation: Left shrink after satisfying counts.

Hints

  1. Expand with the right pointer, then shrink while all required characters are covered.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Busiest Rental Car - Google (easy)
  • Find Common Free Time Slots Across Calendars - Google (easy)
  • Deterministic Task Execution Order - Google (easy)
  • Count Clusters of 2D Points Within a Radius - Google (medium)
  • Infection Spread on a Grid (Cellular Automaton) - Google (hard)