Sollicitatievraag bij Google

mathematical question. it was implementation based