IBM Interview Question

DSA regarding a coding problem