C++ | Dijkstra | Simple Solution
```\nclass Solution {\npublic:\n    int minCost(int maxTime, vector>& edges, vector& passingFees) {\n        int minfs = INT_MAX;\n        \n        vector> adj
```\nclass Solution {\npublic:\n    int minCost(int maxTime, vector<vector<int>>& edges, vector<int>& passingFees) {\n        int minfs = INT_MAX;\n        \n        vector<pair<int,int>> adj[passingFees.size()];\n        \n        // Creating the adjacency list...\n        for(auto it : edges){\n            adj[it[0]].push_back({it[1],it[2]});\n            adj[it[1]].push_back({it[0],it[2]});\n        }\n        \n        // Initialising time and cost array which will be populated as time[i] = minimum time to reach ith node...\n        vector<int> time(passingFees.size(),INT_MAX);\n        \n        // cost[i] = min cost to reach ith node from 0...\n        vector<int> cost(passingFees.size(),INT_MAX);\n        \n        cost[0] = passingFees[0];\n        time[0] = 0;\n        \n        // Creating min-heap which will keep sorted values in priority of { cost, time, node }...\n        priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>> pq;\n        \n        pq.push({cost[0],{0,0}});\n        \n        // Dijkstra\'s Algo...\n        while(!pq.empty()){\n            auto tops = pq.top();\n            pq.pop();\n            \n            int node = tops.second.second;\n            \n            int cst = tops.first;\n            int tm = tops.second.first;\n            \n            if(node == passingFees.size() - 1 && tm <= maxTime){\n                \n                // If we have reached the n-1th node then return the cost...\n                return minfs = min(minfs,cst);\n            }\n            \n            for(auto it : adj[node]){\n                int nowdtm = it.second;\n                int nowcst = passingFees[it.first];\n                \n                // push the node if its cheaper and time to reach it is less than maxTime...\n                if(tm + nowdtm <= maxTime && cost[it.first] >= cst + nowcst){\n                    cost[it.first] = cst + nowcst;\n                    time[it.first] = nowdtm + tm;\n                    pq.push({cst + nowcst,{nowdtm + tm,it.first}});\n                }\n                \n                // push the node if time to reach it is less than the time it took before..\n                else if(nowdtm + tm < time[it.first]){\n                    time[it.first] = nowdtm + tm;\n                    pq.push({cst + nowcst,{nowdtm + tm,it.first}});\n                }\n            }\n            \n        }\n        \n        // If the distance from 0 - N-1 node is not updated then its impossible to reach...\n        if(minfs == INT_MAX) return -1;\n        return minfs;\n        \n    }\n};
['Graph', 'C']