Carvans DSA Learning series

here is the link to the question. My doubt is that in the test case : 4 5 1 2 3, shouldn’t the output be 3(instead of 2)? because cars with maximum speed 1,2, and 3 will be moving with their maximum speed without collision?!

Anyone?

4 5 1 2 3
for this, cars are moving in <---- direction, so, first car is 4, then behind it 5 is there, then 1 is there then 2 and then 3,
hope you get it?

Oh Okay I thought it was given in the right to left order(the car entering the column), Thanks anyway

1 Like