Frage im Vorstellungsgespräch bei Even Financial

Solving a standard Leetcode medium/hard type question.