Install our extension to search inside any video instantly.

LIVE Leetcoding + Atcoding + Ask Me Anything!!!

Added:
237 views7likes1:55:10virenvariyaOriginal Release: 2026-07-19

Given an integer array, the minimum cost to make all elements equal by only increasing elements (adding 1 to any element costs 1) is calculated by finding the maximum element in the array and summing the absolute differences between each element and this maximum value. This works because elements cannot be decreased, so the target value must be at least the maximum element, and the greedy approach of setting all elements to the maximum value yields the minimum cost.