We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Equalize the Array
Equalize the Array
Sort by
recency
|
1903 Discussions
|
Please Login in order to post a comment
JavaScript
In Python using collections library
from collections import Counter
def equalizeArray(arr):
Hi there! Here's my Java solution:
https://github.com/eduardocintra/hacker-rank-solutions/blob/master/src/br/com/eduardocintra/easy/equalizethearray/EqualizeTheArray.java
In C# what You can do is finding all the element with value like all element with thier occurance next thing is calculate total sum and subtract the max value sum in dictionary
JAVA There are some solutions using streams, but maybe it will be more readable for somebody: