Question: Gaps in Traffic STDIN Function 1 0 } - > n = 1 start [ ] size m = 2 start = [ 3
Gaps in Traffic STDIN Function
n
start size m
start
finish size m
finish
Sample Output
Explanation
start finish
The diagram above depicts a road units in length with cars :
The first car spans from position start to position finish
The second car spans from position start to position finish
No car is in positions positions or position The largest gap between cars
is Language
Python
The diagram above depicts a road units in length with cars :
The first car spans from position start to position finish
The second car spans from position start to position finish
The third car spans from position start to position finish
The fourth car spans from position start to position finish
There are gaps at positions and The largest gap between cars is
Autocomplete Read
# INT
# IN
start finish where
Given a lane road with positions and a total number of cars moving from left to
right, from a start position to a finish position, determine the largest gap in positions of all
cars, without regard to lanes.
Example
start
finish
The following is a graphical representation of a snapshot of the cars on the road. start and
finish mark the positions of the rear and front of each car. The length of the road is
start finish
Positions that contain cars are gray, and positions that are open are striped green.
The diagram above depicts a road units in length with cars :
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
