Shortest Path Algorithm Leetcode Python Practice