Airwallex Interview Question

Find the shortest path of a tree