Minimum Array End Leetcode Python