Pregunta de entrevista de WeWork

basic algorithm questions.