← 返回 atlassian 的题目列表Robot Parts Assembly
类型:qbank
Given part identifiers that combine a robot name and a part name, return all robots that have every required part. The prompt uses names like `Rosie_wheel` and a comma-separated required-parts string.
Requirements
Input all_parts contains strings in the form <robot>_<part>, such as Rosie_wheel or Sam_case.
Input required_parts is a comma-separated list such as wheel,case.
Return every robot that can be assembled with all required parts.
Treat the robot name as the prefix before the separator and the part name as the suffix after it.
Notes
Clarify duplicate part entries, malformed strings, and whether part names can contain underscores.
The core structure is a map from robot name to a set of available parts.
Preparation
Implement parsing and set containment cleanly.
Add tests for robots missing one part, duplicate parts, empty required list, and names with shared prefixes.