Pregunta de entrevista de Meta

Two coding questions involving data structures and algorithms.