Shortest Path Problem Leetcode Contest