JS || Solution by Bharadwaj
Code\n\nvar firstDayBeenInAllRooms = function (nextVisit) {\n    let mod = 10 ** 9 + 7;\n    let size = nextVisit.length;\n    let visit = Array(size).fill(0);\
# Code\n```\nvar firstDayBeenInAllRooms = function (nextVisit) {\n    let mod = 10 ** 9 + 7;\n    let size = nextVisit.length;\n    let visit = Array(size).fill(0);\n\n    for (let i = 1; i < size; i++) {\n        let prev = i - 1;\n        let day = visit[prev];\n        let odd = day - visit[nextVisit[prev]] + 1;\n        let even = day + 1;\n\n        visit[i] = (odd + even + mod) % mod;\n    }\n    return visit[size - 1];\n};\n```
['JavaScript']