ServiceNow Interview Question

Leet Code - Write code and explain for "Minimum Time to Complete Trips"