Yahoo Interview Question

Puzzles, algorithms