Question d’entretien chez Two Sigma

A medium leetcode that's on the easier side.