Car fleet arrival
Your task
Cars travel toward a destination at position 'target' on a single-lane road that does not allow passing. Car i starts at position[i] (0 <= position[i] < target) with constant speed[i]. A faster car that catches a slower one ahead slows to that car's speed and they travel as one 'fleet' (they arrive together); a car that catches a fleet at the target also joins it. All start positions are distinct. Return the number of distinct fleets that arrive at the target.
Examples
car_fleet(target: int, position: list[int], speed: list[int]) -> intExample 1
Input
car_fleet(12, [10, 8, 0, 5, 3], [2, 4, 1, 1, 3])Output
3