Minimum Array End Leetcode Problems Python