[Kotlin] Clean and Short O(n) Solution
\nclass Solution {\n    fun firstDayBeenInAllRooms(nextVisit: IntArray): Int {\n        val mod = 1000000007\n        val days = LongArray(nextVisit.size).apply
```\nclass Solution {\n    fun firstDayBeenInAllRooms(nextVisit: IntArray): Int {\n        val mod = 1000000007\n        val days = LongArray(nextVisit.size).apply { set(0, 1L) }\n\n        for (i in 1..days.lastIndex) {\n            days[i] = (days[i - 1] + days[i - 1] - days[nextVisit[i - 1]] + 1 + 1) % mod\n        }\n\n        return ((days.last() + mod - 1) % mod).toInt()\n    }\n}\n```
['Kotlin']