Microsoft codility august 2022

Given a transaction string "BAABA" where B indicates there is a transfer of money from A to B and A indicated there is a transfer of money from B to A and a transaction array "24112" which can be interpreted by the below table as

initial amount 2 4
transfer from A to B 0 6
transfer from B to A 4 2
transfer from B to A 5 1
transfer from A to B 4 2
transfer from B to A 6 0

What should be the minimum initial amount to complete all successful transactions.

Comments (2)