Problem Submissions Solution

Smallest Window of All Characters

Difficulty: Hard

Acceptance: %

Points: 40.00

Given two strings s1 and s2. Find the smallest window in the string s1 consisting of all the characters(including duplicates) of the string s2. return empty string in case no such window is present.

If there are multiple such windows of the same length, return the one with the least starting index.

Note: All characters are in lowercase letters. 

Topics

Companies

Articles

Examples:

NA

Constraints:
  • 1 = |s1|, |s2| = 10^5
Companies:
Amazon Microsoft Google Atlassian Flipkart + 1 more
Topics:
String Dynamic Programming
Locked Content
Access Restricted: Please Login to access the code editor and test cases.