Google Interview Question

On the second technical interview, they've asked to optimize the answer?