Algorithm · Google · Medium
You are given a weighted city network, where every route has a traversal cost. A collection of preferred cities is also supplied. Starting from a specified city, determine which preferred city or cities can be reached with the lowest total route cost. When several preferred cities share that lowest cost, include every one of them. Input: An integer n representing the number of cities. An integer m representing the number of routes. A list named edges containing m tuples;…
Checking your access…