Pergunta de entrevista da empresa Glovo

The hardest question was to implement an algorithm to solve a problem. I managed to solve it using a brute force approach. I would need to have more time and do some drawings to be able to implement a better solution.