Exemplo n.º 1
0
        public string[] solution(string[,] tickets)
        {
            List <string> answer = new List <string>();

            List <Airport> tmp = new List <Airport>();

            for (int i = 0; i < tickets.GetLength(0); i++)
            {
                tmp.Add(new Airport(tickets[i, 0], tickets[i, 1]));
            }
            tmp = new List <Airport>(tmp.OrderBy(x => x.dep).ThenBy(b => b.des));

            for (int i = 0; i < tmp.Count; i++)
            {
                tickets[i, 0] = tmp[i].dep;
                tickets[i, 1] = tmp[i].des;
            }

            visit = new bool[tickets.Length];

            Visit.Enqueue("ICN");
            Dfs("ICN", tickets, 0);

            return(Visit.ToArray());
        }