ZOMATO SDE1 OA (2024) | Sliding Window Optimization for Efficient Pattern Coverage | Java Solution

Zomato · Question · Posted Jun 2026

Q1. Shortest Segment Covering Required Characters Problem Statement You are given two strings: s → source string t → target string Find the smallest contiguous substring of s that contains all characters present in t, including duplicate occurrences. If no such substring exists, return an empty string. The answer is guaranteed to be unique. Example 1 Input s = "ADOBECODEBANC" t = "ABC" Output BANC Example 2 Input s = "a" t = "a" Output a Example 3 Input s ...

The full answer & interview discussion are available to premium members.

Log in Create a free account