Dijkstra

Algorithm/Python

[python/leetcode]cheapest flights within k stops/dijkstra

💬 문제 (leetcode.com/problems/cheapest-flights-within-k-stops/) There are n cities connected by m flights. Each flight starts from city u and arrives at v with a price w. Now given all the cities and flights, together with starting city src and the destination dst, your task is to find the cheapest price from src to dst with up to k stops. If there is no such route, output -1. 💬 코드 class Solution:..

Algorithm/Python

[python/leetcode]network delay time/dijkstra/heapq

💬 문제 You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed edges times[i] = (ui, vi, wi), where ui is the source node, vi is the target node, and wi is the time it takes for a signal to travel from source to target. We will send a signal from a given node k. Return the time it takes for all the n nodes to receive the signal. If it i..

박한결
'Dijkstra' 태그의 글 목록