Medium
You are given directed weighted edges times where times[i] = [u, v, w], n nodes labeled 1..n, and a source k. Return the time for all nodes to receive a signal from k, or -1 if some node is unreachable.
Input: times = [[2,1,1],[2,3,1],[3,4,1]], n = 4, k = 2 Output: 2
Input: times = [[1,2,1]], n = 2, k = 2 Output: -1