← 返回 sofi 的题目列表Choice Options to Ending Rooms
类型:qbank
Karat graph-style coding task: from choices, options, and ending rooms, determine which endings are reachable; follow-up turns the structure into a graph requiring DFS or BFS.
Requirements
Inputs include choice, option, and endingList structures.
A choice resembles choice [start, op1, op2].
Given the available options and ending rooms, return which endings can be reached.
Follow-up: both options must be traversed and the structure becomes a graph.
Use DFS or BFS for the graph version.
Notes
The first version can be solved with straightforward maps from room to next choices.
The follow-up is where cycle handling and visited-state tracking become important.
Full input formatting was not fully leaked; confirm exact tuple layout before coding.