IBM Interview Question

i was unable to crack the the coding round