Google Interview Question

Asked to solve a complex algorithm