Super Short Solution Might make you sad
Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(N)\n\n# Code\npython3 []\nclass Solution:\n    def firstDayBeenInAllRooms(self, nextVisit: List[i
# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(N)\n\n# Code\n```python3 []\nclass Solution:\n    def firstDayBeenInAllRooms(self, nextVisit: List[int]) -> int:\n        MOD = 10**9 + 7\n        n = len(nextVisit)\n        dp = [0] * n\n        for i in range(1, n):\n            dp[i] = (dp[i-1] + 2 + (dp[i-1] - dp[nextVisit[i-1]])) % MOD\n        return dp[-1]\n```
['Python3']