IBM interview question

coding ques 1 easy 1 medium