Max Min Problem Leetcode Python