#3139

Minimum Cost to Equalize Array

grandmaster · 2230 · lc hard +32 · 18.7% accepted · 149 likes · top 1%

Description

Given an integer array nums and costs cost1 and cost2, you may increment one element by 1 (costing cost1) or simultaneously increment two different elements by 1 (costing cost2). Return the minimum total cost to make all elements equal, modulo 109 + 7.

Code

1
2
3