Python (Simple Dijkstra's algorithm)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def minimumMoves(self, grid):\n        n = len(grid)\n        dict1, stack = {(0,0,0,1):0}, [(0,0,0,0,1)]\n\n        while stack:\n            steps,i,j,ii,jj = heappop(stack)\n            if i == n-1 and j == n-2 and ii == n-1 and jj == n-1: return steps\n            if ii+1 < n and grid[i+1][j] == grid[ii+1][jj] == 0 and steps + 1 < dict1.get((i+1,j,ii+1,jj),float("inf")):\n                heappush(stack,(steps+1,i+1,j,ii+1,jj))\n                dict1[(i+1,j,ii+1,jj)] = steps + 1\n            if jj+1 < n and grid[i][j+1] == grid[ii][jj+1] == 0 and steps + 1 < dict1.get((i,j+1,ii,jj+1),float("inf")):\n                heappush(stack,(steps+1,i,j+1,ii,jj+1))\n                dict1[(i,j+1,ii,jj+1)] = steps + 1\n            if i == ii and ii+1 < n and grid[i+1][j] == grid[i+1][jj] == 0 and steps + 1 < dict1.get((i,j,i+1,j),float("inf")):\n                heappush(stack,(steps+1,i,j,i+1,j))\n                dict1[(i,j,i+1,j)] = steps + 1\n            if j == jj and jj+1 < n and grid[i][j+1] == grid[ii][jj+1] == 0 and steps + 1 < dict1.get((i,j,i,j+1),float("inf")):\n                heappush(stack,(steps+1,i,j,i,j+1))\n                dict1[(i,j,i,j+1)] = steps + 1\n\n        return -1\n            \n\n\n\n\n\n\n\n        \n\n\n\n\n        \n\n\n```
['Python3']