Pergunta de entrevista da empresa Uber

Some coding problem based on map