Shortest Path Problem Leetcode Python Solutions