Question: Example 2 : Input: M = 1 0 B = { 1 5 , 5 , 2 } A = { 6 , 4 ,

Example 2:
Input:
M=10
B={15,5,2}
A={6,4,1}
Output: 10
Explanation:
It is optimal not to buy any coins in Bangalore.
Your Task: You have to complete the function MaxMorhev() which takes
integer M(initial money), array B of length 3 represents the cost rate of
coins in Bangalore and array A of length 3 represents the cost rate in
Ahmedabad as input parameters and return maximum money you can
have in Ahmedabad after the transaction of at most one type coins.
Constraints:
1M105
1A[i],B[i]104
ditser function femplate for python?
class solutions
1* det Maxmoney (5,11,M,11,)
( coins-1 sit (sip(ii,A))
89=
1
111213
1314
max money 0 for price ba
num coins M?? price batemabad in coma
If num coins? br
money ahemadabad num coins"rate ahe
max money max (max money, money ahen.
ruturn max money
151
tail I Driver code Ind
 Example 2: Input: M=10 B={15,5,2} A={6,4,1} Output: 10 Explanation: It is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!