Sobes.tech
Junior — Middle+

Shortest substring covering the entire given set of characters

livecode

Task condition

Given a set of characters and a string. The task is to find the shortest substring in the string that contains all characters from the set (other characters may also be present in the substring).

Input: Character set: {a, b, c} Text: "dfagabkaceb" Output: "bkac" or "aceb"