Cover Every Stage
Preview mode. Log in to edit, run, submit, and save progress.
Easy
Cover Every Stage
A training simulator has stages numbered from 1 to n. Two trainees each know how to clear some stages. Given both lists, return YES if their combined knowledge covers every stage, otherwise return NO.
Examples
Example 1
Input:
4 3 1 2 3 2 2 4
Output:
YES
Approach hint
A stage is clearable if it appears in at least one list.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
solution.cpp