3139. Minimum Cost to Equalize Array
You are given an integer array nums and two integers cost1 and cost2. You are allowed to perform either of the following operations any number of times: - Choose an index i from nums and increase nums[i] by 1 for a cost of cost1. - Choose two different indices i, j, from nums and increase nums[i] and nums[j] by 1 for a cost of cost2. Return the minimum cost required to make all elements in the
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start