# Equalize the Array

**Problem:-**Given an array of integers, determine the minimum number of elements to delete to leave only elements of equal value.

Solution:-

A very simple hackerrank problem where we are required to return the min number of deletions to leave only elements of equal value in the array. Let’s move towards the code, here we will require to count the occurrence of elements in arr. so we will use a list comprehension to collect the number of times the values are occurring in the “arr” and store it in list “m”. Then we will find the maximum number from the list “m” which holds the number of occurrence of each element of arr, we will be using in-built function max. Then we will return the difference between length of arr and max of m which will give the minimum number of deletion require to leave only elements of equal value.

`def equalizeArray(arr):`

m=[arr.count(x) for x in arr]

return len(arr)-max(m)

**Conclusion:-There will be time when you will feel all alone unable to cop up with situation the only thing you can do is keep moving forward. Keep learning and keep hustling….(Cheers:- PN)**