Implement Shortest Path Leetcode Python Problems