# Leetcode: Cheapest Flights Within k stops .TLE

my code is giving TLE for 2 test cases…what’s wrong with my code?

Cannot open the link of your submission. I guess leetcode dsnt allow it. Can you paste it here

class Solution {
public:
int findCheapestPrice(int n, vector<vector>& flights, int src, int dst, int k) {
for(int i=0;i<flights.size();i++)
{
int source=flights[i][0];
int destination=flights[i][1];
int weight=flights[i][2];
pair<int,int> edge;
edge.first=destination;
edge.second=weight;
}
tuple<int,int ,int> start;
start=make_tuple(0,src,0);
priority_queue<tuple<int,int,int>,vector<tuple<int,int,int>>,greater<tuple<int,int,int>>> pq;
pq.push(start);
while(pq.size()!=0)
{
tuple<int,int,int> front=pq.top();
pq.pop();
int currentVertex=get<1>(front);
int currentCost=get<0>(front);
int currentStop=get<2>(front);
if(get<1>(front)==dst)
{
return get<0>(front);
}
if(get<2>(front)>k)
{
continue;
}
{
int nextVertex=next.first;
int nextStop=currentStop+1;
int nextCost=currentCost+next.second;
tuple<int,int,int> nextS =make_tuple(nextCost,nextVertex,nextStop);
pq.push(nextS);

``````        }

}
return -1;

}
``````

};