IBM interview question

writing code