Using PriorityQueue, Beats 61%
IntuitionApproachComplexity
Time complexity: O(m∗n∗log(m∗n))

Space complexity: O(m∗n)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: O(m∗n∗log(m∗n))
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(m∗n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```csharp []
public class Solution {
    public int MinTimeToReach(int[][] moveTime) {
        int m = moveTime.Length;
        int n = moveTime[0].Length;

        int[][] minArray = new int[m][];

        for (int i = 0; i < m; i++)
        {
            minArray[i] = Enumerable.Repeat(int.MaxValue, n).ToArray();
        }

        //row col time
        PriorityQueue<(int, int), int> pq = new();
        HashSet<(int, int)> set = new HashSet<(int, int)>();
        minArray[0][0] = 0;
        pq.Enqueue((0,0), 0);

        int[][] directions = new int[][]
        {
            [0,1], [0,-1], [1,0], [-1,0]
        };

        while (pq.Count > 0)
        {
            if (pq.TryDequeue(out var temp, out int _))
            {
                int row = temp.Item1;
                int col = temp.Item2;

                if(row == m-1 && col == n - 1)
                {
                    return minArray[m - 1][n - 1];
                }

                int currentStep = (row + col) %2 == 0 ? 1 : 2;

                if (set.Contains((row, col)))
                {
                    continue;
                }
                else
                {
                    set.Add((row, col));
                }

                foreach (var ar in directions)
                {
                    int x = row + ar[0];
                    int y = col + ar[1];

                    if (x >= 0 && y >= 0 && x < m && y < n)
                    {
                        int time = 0;
                        if (moveTime[x][y] <= minArray[row][col])
                        {
                            time = minArray[row][col] + currentStep;
                        }
                        else
                        {
                            time = moveTime[x][y] + currentStep;
                        }

                        if (time < minArray[x][y])
                        {
                            pq.Enqueue((x, y), time);
                            minArray[x][y] = Math.Min(minArray[x][y], time);
                        }
                    }                        
                }                    
            }
        }

        return minArray[m - 1][n - 1];
    }
}
```
['C#']