Google Interview Question

Some simple algorithm question,