Centific / VO OA Interview Problem: Can You Reach the Last Traffic Light?

15 Views
No Comments

Can You Reach the Last Traffic Light?

distances = [10, 17, 25] traffic lights distance

clock = [3, 5, 10] each has a clock

max_time = 1200 car in zero, constant v, can’t stop

def can_reach_last_traffic(distance, clock, max_time=1200):

This problem asks whether a car starting at position 0 and moving at constant speed without stopping can reach the last traffic light within a time limit, given light positions and clock-based timing rules. The key is to model reachability by time and position, then check which arrival moments are valid under each traffic light’s schedule. Depending on the exact rules, the solution is often a greedy step-by-step simulation, or a shortest-path style search over feasible times.

END
 0