Golang & C++ DP 100% solution
go\nfunc firstDayBeenInAllRooms(nextVisit []int) int {\n\t// reached i+1, reach all elem from 0 to i even times\n\tdp := make([]int, len(nextVisit))\n\tdp[1] = 
```go\nfunc firstDayBeenInAllRooms(nextVisit []int) int {\n\t// reached i+1, reach all elem from 0 to i even times\n\tdp := make([]int, len(nextVisit))\n\tdp[1] = 2\n\tday := 2\n\tfor i := 2; i < len(nextVisit); i++ {\n\t\t// we are in room[i-1] and one day passed\n\t\tday++\n\t\tcurRoom := nextVisit[i-1]\n\t\t// back to room[i-1], cost dp[i-1] - dp[curRoom] day, next day, we will arrival root[i] first time\n\t\t// dp[i] may be less than dp[j] while j < i, so we add another 1000000007\n\t\tday = (day + dp[i-1] - dp[curRoom] + 1 + 1000000007) % 1000000007\n\t\tdp[i] = day\n\t}\n\treturn dp[len(nextVisit)-1]\n}\n```\n\n```c++\nclass Solution {\npublic:\n    int firstDayBeenInAllRooms(vector<int>& nextVisit) {\n        vector<long> dp(nextVisit.size());\n        dp[1] = 2;\n        for (int i = 2; i < nextVisit.size(); i++) {\n            dp[i] = (dp[i-1] + dp[i-1] - dp[nextVisit[i-1]] + 1000000009) % 1000000007;\n        }\n        return static_cast<int>(dp[dp.size()-1]);\n    }\n};\n```
['Dynamic Programming', 'C', 'Go']