human
Maximum Tip Calculator | Recursive function to calculate sum of maximum tip order taken by X and Y.
When all orders have been taken.
When X cannot take more orders.
When Y cannot take more orders.
When both can take order calculate maximum out of two.
Driver code"
Solution in Python:
assistant
#Here is code to maximum Tip Calculator and the other steps required.
 def solve ( i , X , Y , a , b , n ) :
	if ( i == n ) :
		return 0
	if ( X <= 0 ) :
		return ( b [ i ] + solve ( i + 1 , X , Y - 1 , a , b , n ) )
	if ( Y <= 0 ) :
		return ( a [ i ] + solve ( i + 1 , X - 1 , Y , a , b , n ) )
	else :
		return max ( a [ i ] + solve ( i + 1 , X - 1 , Y , a , b , n ) , b [ i ] + solve ( i + 1 , X , Y - 1 , a , b , n ) )
a = [ 1 , 2 , 3 , 4 , 5 ]
b = [ 5 , 4 , 3 , 2 , 1 ]
n = len ( a )
x = 3
y = 3
print ( solve ( 0 , x , y , a , b , n ) )