Problem · Graph
Keys and Rooms
Learn this problemProblem statement
Room zero is initially unlocked. Each room contains keys to other rooms. Return whether all rooms can be visited.
Function
canVisitAllRooms(rooms: int[][]) → booleanExamples
Example 1
rooms = [[1],[2],[3],[]]return = trueKeys discovered in order unlock rooms 1, 2, and 3.
Constraints
1 <= rooms.length <= 10000- Every key is a valid room index.
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024