Pregunta de entrevista de Meta

Algorithm questions, both were really easy