Python Solution
Approach\nShortest Path Algoritm - Dijkstra\'s\n\n# Complexity\n- Time complexity: O( (nm) * log(nm) )\n- Space complexity: O(2nm)\n\n# Code\npython3 []\nclass 
# Approach\nShortest Path Algoritm - Dijkstra\'s\n\n# Complexity\n- Time complexity: $$O( (n*m) * log(n*m) )$$\n- Space complexity: $$O(2*n*m)$$\n\n# Code\n```python3 []\nclass Solution:\n    def minTimeToReach(self, matrix: List[List[int]]) -> int:\n\n        num_rows = len(matrix)\n        num_cols = len(matrix[0])\n        visited = [[False for _ in range(num_cols)] for _ in range(num_rows)]\n\n        directions = [(0, 1), (1, 0), (-1, 0), (0, -1)]\n\n        priority_queue = [(0, 0, 0, True)]  # time, row, col, is_day\n\n        while priority_queue:\n            time, row, col, is_day = heapq.heappop(priority_queue)\n            \n            if row == num_rows - 1 and col == num_cols - 1:\n                return time\n                \n            for dx, dy in directions:\n                new_row, new_col = row + dx, col + dy\n                if (new_row >= num_rows or new_col >= num_cols or \n                    new_row < 0 or new_col < 0 or visited[new_row][new_col]):\n                    continue\n                visited[new_row][new_col] = True\n                additional_time = 1 if is_day else 2\n                heapq.heappush(priority_queue, (max(time + additional_time, matrix[new_row][new_col] + additional_time), new_row, new_col, not is_day))\n        return -1\n```
['Heap (Priority Queue)', 'Shortest Path', 'Python3']