There are M rooms numbered from 0 to M-1, and you begin inside room 0. Each room contains a set of keys that can unlock other rooms.
Specifically, each room i holds a list of keys represented as keysList[i], where each key is an integer between 0 and M-1. Using a key with value k allows you to open room k.
Initially, all rooms are locked except for room 0. You are free to move between any unlocked rooms you have access to.
Your task is to determine if it is possible to enter every room starting from room 0.
Example 1: Input: [[2], [3], [1], []] Output: true Explanation: Start in room 0 and find key 2. Go to room 2 and find key 1. Go to room 1 and find key 3. Go to room 3. Since all rooms are accessible, return true.
Example 2: Input: [[1, 4], [4, 0], [3], [2], []] Output: false Explanation: Rooms 0, 1, and 4 are accessible, but rooms 2 and 3 cannot be reached. Return false.
1 ≤ M ≤ 12000 ≤ keysList[i].length ≤ 12003500.