← ALL NOTES
Depth-First Search

841. Keys and Rooms

There are n rooms, all locked except room 0; each room contains keys to other rooms. Starting from room 0, can you visit all rooms? This is a graph-reachability question in disguise — rooms are…

Loading…