Pregunta de entrevista de Flexible Finance

Leetcode medium question + follow-up