You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good morning! Here's your coding interview problem for today.
This problem was asked by Twitter.
A network consists of nodes labeled 0 to N. You are given a list of edges (a, b, t), describing the time t it takes for a message to be sent from node a to node b. Whenever a node receives a message, it immediately passes the message on to a neighboring node, if possible.
Assuming all nodes are connected, determine how long it will take for every node to receive a message that begins at node 0.
For example, given N = 5, and the following edges:
Good morning! Here's your coding interview problem for today.
This problem was asked by Twitter.
A network consists of nodes labeled 0 to N. You are given a list of edges
(a, b, t)
, describing the time t it takes for a message to be sent from node a to node b. Whenever a node receives a message, it immediately passes the message on to a neighboring node, if possible.Assuming all nodes are connected, determine how long it will take for every node to receive a message that begins at node 0.
For example, given
N = 5
, and the following edges:You should return
9
, because propagating the message from0 -> 2 -> 3 -> 4
will take that much time.The text was updated successfully, but these errors were encountered: