Test Case 2 & 5 are Failing in Network Delay Problem (Advance DS)

#include<bits/stdc++.h>

using namespace std;

class Node

{

public :

          int node;

          int delay;

          Node()

          {

              this->node = 0;

              this->delay =  0;

          }

          Node(int delay , int node)

          {

              this->delay =  delay;

              this->node  =  node;

          }

};

class comp

{

public:

    bool operator()( Node &a ,Node &b)

    {

        if(a.delay > b.delay)

        {

            return true;

        }

        return false;

    }

};

int networkDelayTime(int N ,vector<vector>& times, int K)

{

    priority_queue<Node,vector<Node>,comp> minHeap;

    vector<vector<int>> graph(N,vector<int>(N,-1));

    vector<int> distance(N,1e9);

    for(auto &edge : times)

    {

        graph[edge[0]-1][edge[1]-1] = edge[2];

    }

    minHeap.push(Node(0,K-1));

    distance[K-1] =  0;

    int maxDelay  = -1;

    while(!minHeap.empty())

    {

        Node current = minHeap.top();

        minHeap.pop();

        int currentDelay = current.delay;

        int currentNode  = current.node;

        for(int neigh = 0 ; neigh<N; neigh++)

        {

            if(graph[currentNode][neigh]!=-1)

            {

                if(graph[currentNode][neigh]+currentDelay < distance[neigh])

                {

                    distance[neigh] = graph[currentNode][neigh]+currentDelay;

                    minHeap.push(Node(distance[neigh],neigh));

                }

            }

        }

    }

    for(auto &it : distance)

    {

        if(it == 1e9)

        {

            return -1;

        }

        maxDelay = max(maxDelay,it);

    }

    return maxDelay;

    

}

int main()

{

int nodes, source, e;

cin>>nodes>>e;

vector<vector<int>>edges(e);

for (int i = 0; i < e; i++)

{

    int u,v,t;

    cin>>u>>v>>t;

    edges[i].push_back(u);

    edges[i].push_back(v);

    edges[i].push_back(t);

}

cin>>source;

int ans = networkDelayTime(nodes,edges,source);

cout<<ans;

}

This is my code It got pass at Leetcode but It didn’t passed in Platform . Pls help me out.

It seems like you have already solved and submitted this solution.

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.