human
Check if array contains contiguous integers with duplicates allowed | function to check whether the array contains a set of contiguous integers.
Sort the array.
After sorting , check if current element is either same as previous or is one more ..
Driver code"
How can the above be solved in Python?
assistant
#Here is code to check if array contains contiguous integers with duplicates allowed and the other steps required.
 def areElementsContiguous ( arr , n ) :
	arr . sort ( )
	for i in range ( 1 , n ) :
		if ( arr [ i ] - arr [ i - 1 ] > 1 ) :
			return 0
	return 1
arr = [ 5 , 2 , 3 , 6 , 4 , 4 , 6 , 6 ]
n = len ( arr )
if areElementsContiguous ( arr , n ) : print ( " Yes " )
else : print ( " No " )