Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Why is this solution sufficient for the problem "Speedbreaker"?

Правка en1, от Negationist, 2024-09-28 21:09:27

In the speedbreaker question, why do we need to do: c++ mn[i]=min(mn[i],mn[i-1]),mx[i]=max(mx[i],mx[i-1]);

Full Code

Also, I get why the first condition is necessary for there to be a solutions and I get why the second part of the code finds that good interval, but I'm having a little trouble piecing together the sufficiency of the two to guarantee the right answer. Perhaps this is also why I font understand why you have to do the operations on the mins and maxes too.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Negationist 2024-09-28 21:09:27 1180 Initial revision (published)