Company: MediBuddy_8oct
Difficulty: medium
Longest Path in Network Problem Description You need to complete the function `longestPathInDAG()`. Parameters: N: An integer showing the number of nodes in the network. M: An integer showing the number of connections in the network. edges: A list of M tuples, where each tuple has three numbers u, v, and w showing a connection from node u to node v with value w. Return: A single number showing the total weight of the maximum path in the network. If no path exists, return 0. Input Format: The first line has a number N, showing the number of nodes in the network. The second line has a number M, showing the number of connections in the network. The next M lines have three space-separated numbers u, v, and w showing a connection from node u to node v with value w. Output Format: A single number showing the total weight of the maximum path in the network. If no path exists, return 0. Examples Example 1: Input: 4 5 1 2 5 2 3 10 1 3 15 3 4 10 2 4 20 Output: 25 Explanation: In this graph, the