Bloomberg interview question

Very easy algorithm questions but will follow up.