IBM interview question

some algorithm questions