C# Dynamic Programming
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\npublic class Solution {\n        public int FirstDayBeenInAllRooms(int[] nextVisit)\n        {\n            long[] dp = new long[nextVisit.Length];\n            int mod = (int)1e9 + 7;\n\n            for (int i = 1; i < nextVisit.Length; i++)\n            {\n                if (nextVisit[i - 1] == i - 1)\n                {\n                    dp[i] = dp[i - 1] + 2;\n                }\n                else\n                {\n                    dp[i] = (dp[i - 1] + dp[i-1] - dp[nextVisit[i-1]] + 2 + mod) % mod;\n                }\n            }\n\n            return (int)dp[nextVisit.Length - 1];\n        }\n       \n}\n```
['C#']