#3112
Minimum Time to Visit Disappearing Nodes
expert · 1050 · lc medium +32 · 37.5% accepted · 218 likes · top 16%
Description
An undirected graph with n nodes has edges edges[i] = [ui, vi, lengthi] each requiring lengthi time units to traverse. Node i vanishes at time disappear[i] and cannot be visited at or after that moment. Starting from node 0, return an array answer where answer[i] is the earliest arrival time at node i, or -1 if unreachable.
Code
1
2
3