IBM interview question

DSA regarding a coding problem