using System.Collections.Generic;
public static void Main()
var a = Solution.FindCheapestPrice(
new int[][]{new int[]{1,0,5}},
private const int MaxPrice = 100000;
private const int Inf = 100000000;
public static int FindCheapestPrice(int n, int[][] flights, int src, int dst, int k) {
var dict = new Dictionary<int,List<List<int>>>();
for(int i=0;i<flights.Length;i++){
var from = flights[i][0];
var price = flights[i][2];
var currEdge = new List<int>{from, price};
if(!dict.TryGetValue(to, out output)){
dict[to] = new List<List<int>>();
if(!dict.TryGetValue(i, out temp))
var inwardNeighbours = dict[i];
for(int ne=0;ne<inwardNeighbours.Count;ne++){
var from = inwardNeighbours[ne][0];
var price = inwardNeighbours[ne][1];
"From {0} to {1}, price is {2}",
var newDistance = dp[j-1, from] == Inf ? Inf : dp[j-1, from] + price;
Console.WriteLine("NewDistance is {0}", newDistance);
distance = Math.Min(distance, newDistance);
Console.WriteLine("Distance is {0}", distance);
return dp[k+1,dst] == Inf ? -1 : dp[k+1,dst];