Computer Science, asked by abhishekdl135, 5 months ago

1. Cars and Gaps In Traffic
Given a 2 lane road with n positions and a
total number of m 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
n = 10​

Answers

Answered by sumitkumar04ever
15

bc g t f d best friend is a 8

Answered by nidaeamann
1

Answer:

The complete question statement is;

Given a 2 lane road with n positions and a total number of m cars moving from left to right, from a start position to finish, determine the largest gap in positions of all cars, without regard to lanes.  

Example:

n=10

start=[1,2,5,8]

finish=[2,2,6,10]

Explanation:

In the above problem, we have number of points n=10 units and cars in the lanes m is 4:

Now the first car starts from position 1 to and finishes at position 2

Now the second car starts from position 2 to and finishes at position 2

The third car starts from position 5 to and finishes at position 6

The fourth car starts from position 8 to and finishes at position 10  

Hence the largest gap is 2

Similar questions