2473. Minimum Cost to Buy Apples
ArrayGraph TheoryHeap (Priority Queue)Shortest Path
Hints
Hint 1
Notice that the path you take to buy an apple will be the same path to return to the starting city.
Hint 2
Starting from each city, use Dijkstra’s algorithm to find the best city to travel to.
Preparing judge…