Clear Python code, beats 94%
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: List[List[int]]) -> int:\n        n=len(grid)\n        seen=set()\n        dq=deque()\n        dq.append((0,1,"r",0))\n        seen.add((0,1,"r"))\n        while dq:\n            i,j,pos,val=dq.popleft()\n            if i==n-1 and j==n-1 and pos=="r": return val \n            #move right\n            if j+1<n and grid[i][j+1]==0 and (i,j+1,pos) not in seen:\n                if pos=="r" or pos=="d" and grid[i-1][j+1]==0:\n                    dq.append((i,j+1,pos,val+1))\n                    seen.add((i,j+1,pos))\n            #move down\n            if i+1<n and grid[i+1][j]==0 and (i+1,j,pos) not in seen:\n                if pos=="d" or pos=="r" and grid[i+1][j-1]==0:\n                    dq.append((i+1,j,pos,val+1))\n                    seen.add((i+1,j,pos))\n            #change dir to down if curr is right\n            if pos=="r" and j-1>=0 and i+1<n and grid[i+1][j]==grid[i+1][j-1]==0 and (i+1,j-1,"d") not in seen:\n                dq.append((i+1,j-1,"d",val+1))\n                seen.add((i+1,j-1,"d"))\n            #change dir to right if curr is down\n            if pos=="d" and i-1>=0 and j+1<n and grid[i-1][j+1]==grid[i][j+1]==0 and (i-1,j+1,"r") not in seen:\n                dq.append((i-1,j+1,"r",val+1))\n                seen.add((i-1,j+1,"r"))\n        return -1\n```
['Breadth-First Search', 'Python', 'Python3']