human
Maximum number of multiplication by 3 or division by 2 operations possible on an array | Function to count maximum number of multiplication by 3 or division by 2 operations that can be performed.
Stores the maximum number of operations possible.
Traverse the array arr [ ].
Iterate until arr [ i ] is even.
Increment count by 1.
Update arr [ i ].
Return the value of Count as the answer.
Given Input.
Function Call"
Solution in Python:
assistant
#Here is code to maximum number of multiplication by 3 or division by 2 operations possible on an array and the other steps required.
 def maximumTurns ( arr , N ) :
	Count = 0
	for i in range ( 0 , N ) :
		while ( arr [ i ] % 2 == 0 ) :
			Count += 1
			arr [ i ] = arr [ i ] // 2
	return Count
arr = [ 5 , 2 , 4 ]
M = 3
K = 2
N = len ( arr )
print ( maximumTurns ( arr , N ) )