Domanda di colloquio di Meta

Two coding questions involving data structures and algorithms.