IBM interview question

Then an aptitude problem was asked.