LiveRamp interview question

Both questions from cracking the coding interview book.