findShortestChains function

Find the shortest paths between arrays