Minimum Time to Visit Disappearing Nodes

You are given an undirected weighted graph with n nodes numbered from 0 to n - 1. Each edge edges[i] = [u, v, length] joins nodes u and v and takes length units of time to traverse. You start at node 0 at time 0.

Node i disappears at time disappear[i]. A node can be visited only by arriving strictly before its disappearance time. Return an array where the value at index i is the minimum time needed to reach node i, or -1 when it cannot be visited before disappearing. The starting node has answer 0 when it is available at time 0; otherwise every answer is -1.

Examples
Input: [3,[[0,1,2],[1,2,1],[0,2,4]],[1,1,5]]
Output: [0,-1,4]
Hints

Minimum Time to Visit Disappearing Nodes

You are given an undirected weighted graph with `n` nodes numbered from `0` to `n - 1`. Each edge `edges[i] = [u, v, length]` joins nodes `u` and `v` and takes `length` units of time to traverse. You start at node `0` at time `0`.