Bloomberg interview question

Easy / medium algorithm questions, very easy