Pergunta de entrevista da empresa Uber

how to implement Uber pool. given two trips find and algorithm to see if they should be pooled