Simple C++ Solution || (Using Dijkstra's Algo) ✅✅
Code\ncpp []\nclass Solution {\npublic:\n    int di[4]={1,-1,0,0};\n    int dj[4]={0,0,1,-1};\n    int minTimeToReach(vector<vector<int>>& moveTime) {\n        
# Code\n```cpp []\nclass Solution {\npublic:\n    int di[4]={1,-1,0,0};\n    int dj[4]={0,0,1,-1};\n    int minTimeToReach(vector<vector<int>>& moveTime) {\n        int n=moveTime.size();\n        int m=moveTime[0].size();\n        vector<vector<int>> dist(n,vector<int>(m,INT_MAX));\n        priority_queue<pair<int,pair<int,pair<int,int>>>,vector<pair<int,pair<int,pair<int,int>>>>,greater<pair<int,pair<int,pair<int,int>>>>> pq;\n        pq.push({0,{1,{0,0}}});\n        while(!pq.empty()){\n            auto topu=pq.top();\n            int t=topu.first;\n            int c=topu.second.first;\n            int i=topu.second.second.first;\n            int j=topu.second.second.second;\n            pq.pop();\n            for(int k=0;k<4;k++){\n                int ni=i+di[k];\n                int nj=j+dj[k];\n                if(ni>=0 && nj>=0 && ni<n && nj<m && dist[ni][nj]>(c+max(t,moveTime[ni][nj]))){      \n                    dist[ni][nj]=(c+max(t,moveTime[ni][nj]));\n                    pq.push({dist[ni][nj],{c==1?2:1,{ni,nj}}});\n\n                }\n            }\n        }\n        return dist[n-1][m-1];\n    }\n};\n```
['Graph', 'C++']