Apple Interview Question

Two coding exercises and some follow ups.