Uber Interview Question

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