look at hypothesis to get it (nextVisit[i] <= i)
\nclass Solution {\npublic:\n    int firstDayBeenInAllRooms(vector<int>& nextVisit){\n       long long int mod = 1000000007;\n       long long int dp[100001];\n
```\nclass Solution {\npublic:\n    int firstDayBeenInAllRooms(vector<int>& nextVisit){\n       long long int mod = 1000000007;\n       long long int dp[100001];\n       long long int count = 0;\n       int n = nextVisit.size();\n       for(int i = 0;i < nextVisit.size();i++)\n       {\n           dp[i] = count;\n           count = (count%mod+count%mod)%mod;\n           count = (count+2)%mod;\n           count = (count%mod-dp[nextVisit[i]]%mod+mod)%mod;\n       }\n       return dp[n-1]%mod;\n    }\n    \n}; \n```
[]