IBM Interview Question

Two coding questions, one medium, one hard