← 返回 instacart 的题目列表Compute counts on nested maps (Level 1/Level 2 aggregation)
类型:online_judge
You are given a data structure consisting of nested maps (dictionaries/JSON objects). The data has the notion of “Level 1” and “Level 2” (corresponding to two specific nesting layers).
Compute and output:
Level 1 counts: aggregate counts for each Level 1 entity according to the problem definition.
Level 2 counts: aggregate counts for each Level 2 entity according to the problem definition (note: the definition of this count can be ambiguous).
Requirements:
Traverse the nested map structure and perform the required aggregation.
The output format must match the provided test cases.
Note: The original post does not include the full prompt or test cases. In practice, rely on the platform’s test cases to infer the exact definition of the Level 2 count if unclear.
Example
Input
(insufficient info)
Output
(insufficient info)