Google Interview Question

To solve a coding task.