Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are given a list of N transfers from 0 to N - 1 between two banks: bank A and bank B . The K
You are given a list of N transfers from to N between two banks: bank A and bank B The Kth transfer is described by two values:
RKeither A or B representing the recipient the bank the transfer is sent to;
Vk denoting the
value sent in the wire;
All transfers are completed in the order they appear on the list. The banks do not want the balances to fall below zero. What minimum initial account balance is each bank is necessary in order to complete the transfers?
Write the function
Def solutionR V
That gives a string R and an array of integers V both he length of N returns an array of two integers. The integers should represent a minimum initial account balance for banks A and B in the following order bank A bank B
Result array should be returned as an array of integers.
Write an efficient algorithm for the following assumptions:
String R and array V are both of length N;
N is an integer in the range of
Each element of the array V is an integer within the range of
String R is made only of characters A andor B
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started