Answered step by step
Verified Expert Solution
Link Copied!

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 0 to N-1 between two banks: bank A and bank B. The K-th transfer is described by two values:
R[K](either A or B) representing the recipient (the bank the transfer is sent to);
V[k} 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 solution(R, 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 [1...100,00]
Each element of the array V is an integer within the range of [1...10,000]
String R is made only of characters A and/or B

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

Please solve with correct answer:- \f\f\f\f\f\f\f\f\f\f\f\f\f\f\f

Answered: 1 week ago