This question evaluates system design and algorithmic reasoning for constrained spatio-temporal matching and routing, covering Manhattan-distance geometry, matching algorithms, API and data model design, and scalability/consistency considerations.
Design a ride-sharing (UberPool-like) system focused on matching and routing.
You are operating on a grid where travel distance is Manhattan distance:
.
A driver starts at S and wants to go to destination T. The driver is willing to pick up additional riders only if doing so does not increase the driver’s total travel distance, i.e., the final driven distance must remain exactly .