You are tasked with building an ant colony consisting of prevRoom of length prevRoom[i] represents the room that must be built before room i can be built.
Room prevRoom[0] being i, you may only build room i after room prevRoom[i] has already been completed.
Return the number of distinct valid orders in which all
Constraints:
n prevRoom.length
n
prevRoom[0]
prevRoom[i] n for all i n
Every room is reachable from room
You are tasked with building an ant colony consisting of prevRoom of length prevRoom[i] represents the room that must be built before room i can be built.
Room prevRoom[0] being i, you may only build room i after room prevRoom[i] has already been completed.
Return the number of distinct valid orders in which all
Constraints:
n prevRoom.length
n
prevRoom[0]
prevRoom[i] n for all i n
Every room is reachable from room