Microsoft Interview Question

The programming question because time was running out.