IBM interview question

Algorithms and database