IBM interview question

Two coding questions were asked