Google Interview Question

The problem was not difficult, simple algorithmic skills would get you through