Easy C++ Solution
\n# Code\n\nclass Solution {\npublic:\n    int firstDayBeenInAllRooms(vector<int>& nextVisit)\n    {\n        int n=nextVisit.size();\n        vector<long long>
\n# Code\n```\nclass Solution {\npublic:\n    int firstDayBeenInAllRooms(vector<int>& nextVisit)\n    {\n        int n=nextVisit.size();\n        vector<long long>dp(n,0);\n        long long mod=1e9+7;\n        for (int i=1;i<n;i++)\n        {\n            if(nextVisit[i-1]==i-1)\n            dp[i]=(dp[i-1]+2+mod)%mod;\n            else{\n                dp[i]=(dp[i-1]+2+dp[i-1]-dp[nextVisit[i-1]]+mod)%mod;\n            }\n        }\n        return dp[n-1];\n    }\n};\n```
['C++']