Google Interview Question

Simple starter but increases difficulty in improving an algorithm