IBM interview question

2 coding questions easy to medium level