human
Check if at least half array is reducible to zero by performing some operations | Function to print the desired result after computation.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to check if at least half array is reducible to zero by performing some operations and the other steps required.
 def isHalfReducible ( arr , n , m ) :
	frequencyHash = [ 0 ] * ( m + 1 ) ;
	i = 0 ;
	while ( i < n ) :
		frequencyHash [ ( arr [ i ] % ( m + 1 ) ) ] += 1 ;
		i += 1 ;
	i = 0 ;
	while ( i <= m ) :
		if ( frequencyHash [ i ] >= ( n / 2 ) ) :
			break ;
		i += 1 ;
	if ( i <= m ) :
		print ( " Yes " ) ;
	else :
		print ( " No " ) ;
arr = [ 8 , 16 , 32 , 3 , 12 ] ;
n = len ( arr ) ;
m = 7 ;
isHalfReducible ( arr , n , m ) ;