Leetcode Minimum Cost To Make Array Function