Equal Piles
Given a list of integers nums, you can perform the following operation: pick the largest integer in nums and turn it into the second largest number.
Return the minimum number of operations required to make all integers the same in the list.
Constraints
n ≤ 100,000wherenis the length ofnums
https://binarysearch.com/problems/Equal-Piles
Examples
Example 1
Input
- nums =
[4, 8, 2]
Output
- answer =
3
Explanation
- Turn
8to4to get[4, 4, 2] - Turn
4to2to get[2, 4, 2] - Turn
4to2to get[2, 2, 2]
Leave a comment