IBM Interview Question

coding ques 1 easy 1 medium