Leetcode Shortest Path Problem Application