IBM interview question

Algorithm + Data structures