← 返回 amazon 的题目列表Satisfy Event Schema
类型:online_judge
The problem is as follows:
Given an input List<List<String>> events and an integer maxNumber, for example <<a,b>,<a,b,c>,<c,d>> maxNumber = 2. You need to output a schema format that includes required[] (all must be satisfied), optional[] (any number can be satisfied, including zero), ensuring that all events can at least match one of the output schemas. Define the number of schemas to be no more than maxNumber. For example, for the provided input you can produce the following result: 1 <[a,b],[c]> 2<[c,d],[]>, where the first two events satisfy the first schema and the third event satisfies the second schema. The output should be a feasible List<schema> result, ensuring that result.size <= maxNumber.
Example
Input
events = [['a', 'b'], ['a', 'b', 'c'], ['c', 'd']], maxNumber = 2