There are n rooms labeled from 0 to n - 1, and all rooms are locked except for room 0.
Your goal is to visit all the rooms.
• You can only enter a locked room if you have its key.
• When you enter a room, you may find one or more keys that unlock other rooms.
• You can carry all the keys you find to use later.
Return True if you can visit every room, otherwise False.
Input: rooms = [[1],[2],[3],[]]
Output: True
Input: rooms = [[1,3],[3,0,1],[2],[0]]
Output: False
Accepted:
Submission: