human
Write me a code to minimum sum possible by removing all occurrences of any array element and the other steps required given the following:
Minimum sum possible by removing all occurrences of any array element | Function to find minimum sum after deletion.
Stores frequency of array elements.
Traverse the array.
Calculate sum.
Update frequency of the current element.
Stores the minimum sum required.
Traverse map.
Find the minimum sum obtained.
Return minimum sum.
Input array.
Size of array"
How can the above be solved in Python?
assistant
#Here is code to minimum sum possible by removing all occurrences of any array element and the other steps required.
 def minSum ( A , N ) :
	mp = { }
	sum = 0
	for i in range ( N ) :
		sum += A [ i ]
		if A [ i ] in mp :
			mp [ A [ i ] ] += 1
		else :
			mp [ A [ i ] ] = 1
	minSum = float ( ' inf ' )
	for it in mp :
		minSum = min ( minSum , sum - ( it * mp [ it ] ) )
	return minSum
arr = [ 4 , 5 , 6 , 6 ]
N = len ( arr )
print ( minSum ( arr , N ) )