Domanda di colloquio di Goldman Sachs

two leetcode questions from two people