BackhardSliding Window Netflix

Minimum Window Extractor Solution

Problem Statement

A surveillance system scans a video feed (represented as a string of event codes). Find the shortest continuous segment of feed that contains all the alarm codes specified in a given pattern. Return the shortest window containing all the alarm codes. Return 'NO' if not found.

Example 1
Input
video feed: ABCDE, pattern: A, B, C
Output
ABC

Explanation: Step-by-step: The pattern A, B, C is not found in the given video feed ABCDE. The solution should return the shortest window containing all the alarm codes. The shortest window is 'ABC'.

Example 2
Input
video feed: ABCDE, pattern: A, C, E
Output
NO

Explanation: Step-by-step: The pattern A, C, E is not found in the given video feed ABCDE. The solution should return 'NO' because there is no window that contains all the alarm codes.

Constraints

  • 1 <= s.length, t.length <= 10^5
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free