Tuesday common C++ interview problem: Locked doors.
Given an array of n locked rooms, each room containing 0..n distinct keys, determine whether you can visit each room.
You are given the key to room zero, and each room can only be opened with the corresponding key. Assume that you can freely move between rooms.
Solve it yourself: https://compiler-explorer.com/z/zx85hGx7T
Solution: https://compiler-explorer.com/z/bY9q9xd85