Back to problems

Solve substring and worker assignment

Algorithm · Lyft · Hard

Part 1: Shortest Covering Substring You are given two strings s and t. Find the shortest contiguous block of s that contains every character that appears in t, with at least the same multiplicity. For instance, when t = "AABC", the block must include no fewer than two 'A's, one 'B', and one 'C'. If several blocks have the same minimum length, return the one that starts earliest in s. If no qualifying block exists, return "". Example 1: Explanation: "cwae" contains one 'c',…

Checking your access…