IBM interview question

Coding interview challenge on zoom