human
Making elements distinct in a sorted array by minimum increments | To find minimum sum of unique elements.
If violation happens , make current value as 1 plus previous value and add to sum ..
No violation ..
Drivers code"
How can the above be solved in Python?
assistant
#Here is code to making elements distinct in a sorted array by minimum increments and the other steps required.
 def minSum ( arr , n ) :
	sum = arr [ 0 ] ; prev = arr [ 0 ]
	for i in range ( 1 , n ) :
		if arr [ i ] <= prev :
			prev = prev + 1
			sum = sum + prev
		else :
			sum = sum + arr [ i ]
			prev = arr [ i ]
	return sum
arr = [ 2 , 2 , 3 , 5 , 6 ]
n = len ( arr )
print ( minSum ( arr , n ) )