4 3 5 1 in this case your code give min=2 max=4 correct answer is min =3 max=4
as your code is considering min by 5 in which 5 and 1 get infected but 4 and 3 would also get infected as 1 is infected and 4 and 3 have more speed than him
by 4 by 3 by 5 by 1
max=3 max=3 max=4 max=4
Yeah, same. That will be the case.
Plus you should consider time as well to keep track of whether there can be more crossing among other runners after the time when two runners come in contact and get infected.