Google Interview Question

second question because that's require a lot of performance consideration.