'''
Created on Mar 19, 2017

@author: MT
'''

_______ h__

c_ Solution(o..
    ___ findItinerary_orig  tickets
        __ n.. tickets:
            r..    # list
        hashmap    # dict
        ___ t1, t2 __ tickets:
            __ t1 n.. __ hashmap:
                hashmap[t1]    # list
            h__.heappush(hashmap[t1], t2)
        result    # list
        dfs(result, hashmap, 'JFK')
        r.. ?
        
    ___ dfs  result, hashmap, elem
        w.... hashmap.g.. elem
            dfs(result, hashmap, h__.heappop(hashmap[elem]
        result.i.. 0, elem)
    
    ___ test
        testCases [
            [["MUC", "LHR"], ["JFK", "MUC"], ["SFO", "SJC"], ["LHR", "SFO"]],
            [["JFK","SFO"],["JFK","ATL"],["SFO","ATL"],["ATL","JFK"],["ATL","SFO"]],
            [["JFK","KUL"],["JFK","NRT"],["NRT","JFK"]],
        ]
        ___ tickets __ testCases:
            print('tickets: %s' % tickets)
            result findItinerary(tickets)
            print('result: %s' % result)
            print('-='*20+'-')

__ _____ __ _____
    Solution().test()


e7b9fc5fed7758e40158bc26981ae2fdfeb755ab
'''
Created on Mar 19, 2017

@author: MT
'''

_______ h__

c_ Solution(o..
    ___ findItinerary_orig  tickets
        __ n.. tickets:
            r..    # list
        hashmap    # dict
        ___ t1, t2 __ tickets:
            __ t1 n.. __ hashmap:
                hashmap[t1]    # list
            h__.heappush(hashmap[t1], t2)
        result    # list
        dfs(result, hashmap, 'JFK')
        r.. ?
        
    ___ dfs  result, hashmap, elem
        w.... hashmap.g.. elem
            dfs(result, hashmap, h__.heappop(hashmap[elem]
        result.i.. 0, elem)
    
    ___ test
        testCases [
            [["MUC", "LHR"], ["JFK", "MUC"], ["SFO", "SJC"], ["LHR", "SFO"]],
            [["JFK","SFO"],["JFK","ATL"],["SFO","ATL"],["ATL","JFK"],["ATL","SFO"]],
            [["JFK","KUL"],["JFK","NRT"],["NRT","JFK"]],
        ]
        ___ tickets __ testCases:
            print('tickets: %s' % tickets)
            result findItinerary(tickets)
            print('result: %s' % result)
            print('-='*20+'-')

__ _____ __ _____
    Solution().test()

