Amazon Interview Question

Graphs - finding segment between two child nodes