Shortest Path Problem Leetcode 150