Yahoo Interview Question

Two coding questions not easy