public void GetRoutes() { var routes = new RouteList(TestTriangle[0][0]); routes.Grow(); foreach (var route in routes) { Console.WriteLine(route); } }
public static void Main(string[] args) { var routes = new RouteList(Triangle[0][0]); routes.Grow(); var highestSumRoute = routes.OrderBy(route => route.RouteSum).LastOrDefault(route => route.IsValid); Console.WriteLine(highestSumRoute == null ? $"There is no valid route in the triangle" : $"Route with highest sum is {highestSumRoute}"); }