Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How can you find the shortest distance from one node to all nodes in the graph?
Use BFS to find the shortest distance from both node1 and node2 to all nodes in the graph. Then iterate over all nodes, and find the node with the minimum max distance.