Shortest Path Algorithm Leetcode Premium