Pregunta de entrevista de LiveRamp

Both questions from cracking the coding interview book.