LinkedIn interview question

nothing was unexpected, simple algorithm questions