human
Check if an array contains only one distinct element | Function to find if the array contains only one distinct element.
Create a set.
Compare and print the result.
Driver code.
Function call"
Solution in Python:
assistant
#Here is code to check if an array contains only one distinct element and the other steps required.
 def uniqueElement ( arr , n ) :
	s = set ( arr )
	if ( len ( s ) == 1 ) :
		print ( ' YES ' )
	else :
		print ( ' NO ' )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 9 , 9 , 9 , 9 , 9 , 9 , 9 ]
	n = len ( arr )
	uniqueElement ( arr , n )