Question d’entretien chez Palantir Technologies

About a medium difficulty Leetcode question, then runtime.