Pregunta de entrevista de Stripe

Algorithmic programming exercise of a financial themed problem