human
Check if array elements are consecutive | Added Method 3 | Helper functions to get minimum and maximum in an array The function checks if the array elements are consecutive . If elements are consecutive , then returns true , else returns false.
1 ) Get the minimum element in array.
2 ) Get the maximum element in array.
3 ) max - min + 1 is equal to n then only check all elements.
if the value at index j is negative then there is repetition.
If we do not see a negative value then all elements are distinct.
if ( max - min + 1 != n ).
UTILITY FUNCTIONS.
Driver Code"
Solution in Python:

Can you provide a code to check if array elements are consecutive and the other steps required?
assistant
#Here is code to check if array elements are consecutive and the other steps required.
 def areConsecutive ( arr , n ) :
	if ( n < 1 ) :
		return False
	min = getMin ( arr , n )
	max = getMax ( arr , n )
	if ( max - min + 1 == n ) :
		for i in range ( n ) :
			if ( arr [ i ] < 0 ) :
				j = - arr [ i ] - min
			else :
				j = arr [ i ] - min
			if ( arr [ j ] > 0 ) :
				arr [ j ] = - arr [ j ]
			else :
				return False
		return True
	return False
def getMin ( arr , n ) :
	min = arr [ 0 ]
	for i in range ( 1 , n ) :
		if ( arr [ i ] < min ) :
			min = arr [ i ]
	return min
def getMax ( arr , n ) :
	max = arr [ 0 ]
	for i in range ( 1 , n ) :
		if ( arr [ i ] > max ) :
			max = arr [ i ]
	return max
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 4 , 5 , 3 , 2 , 6 ]
	n = len ( arr )
	if ( areConsecutive ( arr , n ) == True ) :
		print ( " ▁ Array ▁ elements ▁ are ▁ consecutive ▁ " )
	else :
		print ( " ▁ Array ▁ elements ▁ are ▁ not ▁ consecutive ▁ " )