Implement Shortest Path Leetcode Python Practice