Minimum Path Sum Leetcode Solution Python