Multi Source BFS || C++ || Simple || Clean || Short || Fast
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 {\npublic:\n    #define ll long long\n\n    vector<vector<ll>>dx={{0,1},{0,-1},{0,0},{1,1}},dy={{0,-1},{0,1},{1,1},{0,0}};\n\n    bool issafe(ll a,ll b,ll c,ll d,ll n,ll m,vector<vector<int>>&grid){\n        return a>=0 && a<n && b>=0 && b<n && c>=0 && c<m && d>=0 && d<m && grid[a][c]==0 && grid[b][d]==0;\n    }\n    \n    int minimumMoves(vector<vector<int>>& grid) {\n        ll n=grid.size(),m=grid[0].size(),dist=0;\n        queue<vector<ll>>q;q.push({0,0,0,1});\n        vector<vector<vector<bool>>>visited(n,vector<vector<bool>>(n,vector<bool>(2,false)));\n        while(!q.empty()){\n            ll size=q.size();\n            while(size--){\n                auto temp=q.front();q.pop();\n                if(visited[temp[2]][temp[3]][(temp[2]==temp[0]?0:1)]==true){\n                    continue;\n                }\n                if(temp[0]==n-1 && temp[1]==m-2 && temp[2]==n-1 && temp[3]==m-1){\n                    return dist;\n                }    \n                for(ll i=0;i<4;i++){\n                    if((temp[0]==temp[2] && i==1) || (temp[1]==temp[3] && i==0)){\n                        continue;\n                    }\n                    ll x1=temp[0]+dx[i][0],x2=temp[2]+dx[i][1],y1=temp[1]+dy[i][0],y2=temp[3]+dy[i][1];\n                    if(issafe(x1,x2,y1,y2,n,m,grid) && visited[x2][y2][(x2==x1?0:1)]==false){\n                        if(i<=1){\n                            if(grid[temp[0]+1][temp[1]+1]==1){\n                                continue;\n                            }\n                        }\n                        q.push({x1,y1,x2,y2});\n                    }\n                }\n                visited[temp[2]][temp[3]][(temp[2]==temp[0]?0:1)]=true;\n            }\n            dist++;\n        }\n        return -1;\n    }\n};\n```
['C++']