Pregunta de entrevista de Meta

General algorithm questions on the more difficult side.