Duolingo Interview Question

find the shortest path base on the current path input