Leetcode Minimum Cost To Make Array In Python