Assign people to cars based on shortest travel time from two start points.

Asked at Karat · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026

Given a list of roads, each described in the format `[Origin, Destination, Duration]`. There are two starting locations and a list that contains people and their locations. Both cars leave from their respective starting locations simultaneously, and the first car to reach someone's location will pick them up. If both cars arrive at the same time, the person can choose either car. Return who will be in each car upon arriving at the campground.

Loading the problem…