Fleetworks Interview Question

Algorithm problem solving which is reasonable