python | Arrival Time of each element
Initital Thought:\n1. You will go right only when visited count for the element is Even... will that mean whenever we go right to any element their visited coun
Initital Thought:\n1. You will go right only when visited count for the element is Even... will that mean whenever we go right to any element their visited count is multiple of 2 or 0(if we take %2) so you can think like we come to that element first time. Will I need to solve something, or can store this in some array?\n2. What will I store it? We need to return the arrival time when code reach to last element so we can just arrival time of each element.\n\nWill that help? YES, below is my code for reference:\n```\nclass Solution:\n    def firstDayBeenInAllRooms(self, nextVisit: List[int]) -> int:\n        time_taken = 0\n        n = len(nextVisit)\n        arrival_time = [0]*n\n        MOD = 10**9 + 7\n        \n        for i, next_room in enumerate(nextVisit):\n            if i != 0:\n                arrival_time[i] = 1 + arrival_time[i-1] + time_taken\n            time_taken = (arrival_time[i] - arrival_time[next_room])+1\n        \n        return (arrival_time[-1])%MOD\n\n```
[]