Shortest Path Algorithm Leetcode Contest