Maximum money that can be withdrawn in two steps | Function to return the maximum coins we can get ; Update elements such that X > Y ; Take from the maximum ; Refill ; Again , take the maximum ; Driver code
def maxCoins ( X , Y ) : NEW_LINE INDENT if ( X < Y ) : NEW_LINE INDENT X , Y = Y , X ; NEW_LINE DEDENT coins = X ; NEW_LINE X -= 1 ; NEW_LINE coins += max ( X , Y ) ; NEW_LINE return coins ; NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT X = 7 ; Y = 5 ; NEW_LINE print ( maxCoins ( X , Y ) ) ; NEW_LINE DEDENT