Same code as 3341 with only 1 change | Easy and beginner friendly
\n# Code\ncpp []\nclass Solution {\npublic:\n    int minTimeToReach(vector<vector<int>>& moveTime) {\n        int row = moveTime.size();\n        int col = move
\n# Code\n```cpp []\nclass Solution {\npublic:\n    int minTimeToReach(vector<vector<int>>& moveTime) {\n        int row = moveTime.size();\n        int col = moveTime[0].size();\n        priority_queue<tuple<int, int, int,int>, vector<tuple<int, int, int,int>>,greater<tuple<int, int, int,int>>> pq;\n        vector<vector<int>> times(row, vector<int>(col, INT_MAX));\n        pq.push({0,0,0,0});\n        vector<pair<int,int>> dir= {{0,1},{0,-1},{1,0},{-1,0}};\n        while(!pq.empty()){\n            auto [time, x, y,flip]=pq.top();\n            pq.pop();\n            if(x==row-1 && y==col-1) return time;\n            int i=0;\n            while(i<4){\n                int newX= x+ dir[i].first;\n                int newY = y+ dir[i].second;\n                if(newX<row && newX>=0 && newY<col && newY>=0 && times[newX][newY]==INT_MAX){\n                   if(time>=moveTime[newX][newY]) times[newX][newY]=time+ flip%2+1;\n                   else times[newX][newY]=moveTime[newX][newY] +flip%2+1;\n                    pq.push({times[newX][newY],newX,newY,flip%2+1});\n                }\n                i++;\n            }\n        }\n        return -1;\n    }\n};\n```
['C++']