Network Delay Time
Difficulty: Medium | Category: Graph | Asked at: Google, Meta, Amazon | Platform: Unfoldd Arena
Network Delay Time ================ ### Problem Statement There are `n` network nodes, and they are labeled from `0` to `n-1`. You are given the following information: - A list of `m` edges, where each edge is described by an array of three integers `[source, destination, weight]`. These edges represent the connections between the network nodes. - You are also given an array `time` of length `n`, where `time[i]` represents the time taken to traverse from node `i` to all other nodes. You need to calculate the minimum time it takes for all nodes to receive information. If the network is disconnected, return `-1`. ### Rules and Constraints - The graph is represented as an adjacency list where each node has a weight (time) associated with it. - The weight (time) associated with an edge is considered to be the weight of the edge instead of the edge's capacity. - The input graph may contain self-loops and multiple edges between the same pair of nodes, but the weight will only be considered once. - You must consider that the weight of the edges may not be symmetric. - The network nodes are numbered from `0` to `n-1`. ### Complexity Constraints - The time complexity of your solution should be `O(m + n log n)` in the worst case. ### Example **Input:** {"input_data":[1,2,3]} **Output:** [1,2,3]
Solve Network Delay Time online for free in Python, JavaScript, Java, C++, TypeScript, Go, Rust, PHP, Swift, Kotlin, Dart, Ruby, C, and C#. Practice Medium level coding interview problems with instant test case evaluation and AI-powered analysis.
Keywords: Network Delay Time solution, Network Delay Time leetcode, Network Delay Time python, Network Delay Time javascript,Network Delay Time java, Network Delay Time approach, how to solve Network Delay Time, medium coding problems, Graph problems, coding interview preparation, DSA practice free.