Path With Minimum Effort Leetcode Problems Python