Pregunta de entrevista de Meta

Two LC-style questions (Both medium difficulty)