Pergunta de entrevista da empresa LiveRamp

Both questions from cracking the coding interview book.