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
def maximumTurns ( arr , N ) : NEW_LINE INDENT Count = 0 NEW_LINE for i in range ( 0 , N ) : NEW_LINE INDENT while ( arr [ i ] % 2 == 0 ) : NEW_LINE INDENT Count += 1 NEW_LINE arr [ i ] = arr [ i ] // 2 NEW_LINE DEDENT DEDENT return Count NEW_LINE DEDENT arr = [ 5 , 2 , 4 ] NEW_LINE M = 3 NEW_LINE K = 2 NEW_LINE N = len ( arr ) NEW_LINE print ( maximumTurns ( arr , N ) ) NEW_LINE