Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Consider what the paths from src1 to dest and src2 to dest would look like in the optimal solution.
It can be shown that in an optimal solution, the two paths from src1 and src2 will coincide at one node, and the remaining part to dest will be the same for both paths. Now consider how to find the node where the paths will coincide.
How can algorithms for finding the shortest path between two nodes help us?