IBM Interview Question

Asked me to solve the same question i had solved in the coding round.