Google Interview Question

Scaling problem