Shortest Path Problem Leetcode Python Basic Programs