Company: CodeSignal

Difficulty: medium

Problem Statement

Smallest Golden-Element Subchain Given a chain of element labels and a list of required golden elements, print the shortest contiguous subchain containing every distinct required label. If several shortest subchains exist, print the leftmost one. If no such subchain exists, print an empty line. Input The first line contains `n`; the second line contains `n` chain labels. The third line contains `m`; the fourth line contains `m` required labels. Labels contain no whitespace. Output Print the selected labels separated by one space. Example Input: chain `O C Ra Li Na`, required labels `Li C` Output: `C Ra Li`

More CodeSignal OA questionsInterview experiences