easy DP solution O(n) with explanation.
If we observe then atleast two days  are needed to go from one room to next one when NextRoom[i]==i .\nsecond thing is that we can observe that if NextRoom[i]=j
If we observe then atleast two days  are needed to go from one room to next one when NextRoom[i]==i .\nsecond thing is that we can observe that if NextRoom[i]=j  where j<i  , then the number of days needed to go from first visit to room  i to i+1 is  summation of  number of days needed to  go from   \nj to (j+1)  + (j+1) to (j+2) .......  (i-1) to i  +2 . \n\n```\nclass Solution {\npublic:\n    int firstDayBeenInAllRooms(vector<int>& nv) {\n        long long mod=1000000007;\n        long long n=nv.size();\n \n        vector<long long> days(n,0);\n        days[0]=0;\n        for(int i=0;i<n-1;i++){\n            if(i==nv[i]){\n                days[i+1]=(days[i]+2)%mod;\n            }\n            else {\n                days[i+1]= ( 2*days[i]-days[nv[i]]+2)%mod;\n                days[i+1]= ( days[i+1] +mod)%mod;\n            }\n        }\n        return days[n-1];\n        \n    }\n};\n```
[]