There are n rooms labeled from n
You are given a nextVisit of length n. When you are in room i on any day:
If you have visited room i an odd number of times (including the current visit), the next room you visit will be nextVisit[i].
If you have visited room i an even number of times (including the current visit), the next room you visit will be (i + 1) % n.
Return the first day on which you have visited every room at least once. Since the answer may be very large, return it modulo
Constraints:
n == nextVisit.length
n
nextVisit[i] i
There are n rooms labeled from n
You are given a nextVisit of length n. When you are in room i on any day:
If you have visited room i an odd number of times (including the current visit), the next room you visit will be nextVisit[i].
If you have visited room i an even number of times (including the current visit), the next room you visit will be (i + 1) % n.
Return the first day on which you have visited every room at least once. Since the answer may be very large, return it modulo
Constraints:
n == nextVisit.length
n
nextVisit[i] i