Super Easy Amazing DP Solution
\nclass Solution {\npublic:\n    int mod=1e9+7;\n    int firstDayBeenInAllRooms(vector& nxt) {\n        int n=nxt.size();\n        vectordp(n,0);\n        dp[0]
```\n```class Solution {\npublic:\n    int mod=1e9+7;\n    int firstDayBeenInAllRooms(vector<int>& nxt) {\n        int n=nxt.size();\n        vector<int>dp(n,0);\n        dp[0]=1;\n        for(int i=1;i<n-1;i++){\n            if(nxt[i]!=i){\n               \n                dp[i]=((dp[i-1]%mod*2)%mod+1-((nxt[i]-1>=0)?dp[nxt[i]-1]:0)+mod)%mod;\n            }\n            else{\n                dp[i]=dp[i-1]%mod+1;\n            }\n            dp[i]=dp[i]%mod;\n        }\n        \n        return (dp[n-2]%mod*2)%mod;\n    }\n};\n```\n\n```\n```\n```
[]