Leetcode 841. Keys and Rooms
- Type: Graph (dfs/bfs)
- Approach:
- Dfs: use basic dfs to traverse each room and use a visited set to store the visited room.
- Bfs: use basic bfs to traverse each room and use a visited set to store the visited room.
- Complexity:
- Time: O(V+E)
- Space: O(V)