Python|TC O(n)|Detailed and easy-to-understand comments
```\ndef firstDayBeenInAllRooms(self, nextVisit: List[int]) -> int:\n        n = len(nextVisit)\n        # firstArrivalDay[i] means the day of first time to vis
```\ndef firstDayBeenInAllRooms(self, nextVisit: List[int]) -> int:\n        n = len(nextVisit)\n        # firstArrivalDay[i] means the day of first time to visit room i. One important thing worth noting is if room i is firstly visited,\n        # all preceding rooms i.e. 0,1,..,i-1 are visited even times, essentially, it\'s same state all preceding rooms are not visited.\n        # So, if on day t, we firstly visited room i-1, on which day will we visit room i? There are two cases to handle:\n        # 1. if nextVisit[i-1] is i-1, it will take two days to visit room i which is day t+2\n        # 2. if nextVisit[i-1] is smaller than i-1, let j = nextVisit[i-1], on day t+1, we goes back to room j. Note: on day t+1, it will be odd times to visit j.\n        # Because all other rooms are visited even times, same with never be visited. So it will take same amout of days to move from room j to room i-1 with (firstArrivalDay[i-1] - firstArrayDay[j])\n        firstArrivalDay = [0]*n\n        MOD = 10**9 + 7\n        \n        for i in range(1, n):\n            if nextVisit[i-1] == i-1:\n                firstArrivalDay[i] = firstArrivalDay[i-1] + 1 + 1\n            else:\n                firstArrivalDay[i] = firstArrivalDay[i-1] + 1 + (firstArrivalDay[i-1] - firstArrivalDay[nextVisit[i-1]]) + 1\n        if firstArrivalDay[n-1] > MOD:\n            return firstArrivalDay[n-1] % (MOD)\n        else:\n            return firstArrivalDay[n-1]
[]