Problem Brief
Find the Path
FULLTIMEOA
Given a graph of N nodes named with 1 to N and M bidirectional weighted edges. Find the path from 1 to N such that weight of maximum in the path is minimum and the number of edges in path won't exceed K.
1Example 1
Input
N = 4, edges = [[1, 2, 4], [1, 3, 2], [2, 4, 5], [2, 3, 6]], K = 3
Output
5
Explanation
Note: I'm more than happy to make modifications if anything in the input seems incorrect. You can reach me in our Discord group! 😊
Possible routes from 1 to 4 is [1->2->3, 1->3->2->4]
As the maximum in path 1 -> 2 -> 4 is 5 on the edge 2->4, while in 1->3->2->4 is 6 at edge 3->2.