Pregunta de entrevista de Morgan Stanley

Portfolio balances problem from Hackerrank - 1st round - medium