Shortest Path Problem Leetcode