IBM Interview Question

2 coding questions easy to medium level