Marks :10
: 0 | : 0
Amy has an array $$$a$$$ of $$$N$$$ integers. In one operation, she can select a non-empty subsequence of A, and decrease each element of the subsequence by 1.
Find the minimum number of operations required to make all the elements of the array equal.
The first line of input consists of a single integer $$$N$$$ $$$(1 \leq N \leq 10^6)$$$ $$$-$$$ the total number of elements in the array. The second line of the input consists of $$$N$$$ space separated integers - the elements of the array $$$(1 \leq a[i] \leq 10^9)$$$.
The output should consist of a single integer - the minimum number of operations required to make all the elements of the array equal.
3 2 1 2
1
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.