IBM interview question

Didn’t pass the coding round