Message from C, C++ talks
My idea that in this loop you always keep the part on the left in the state when there are no ascending values. So after this loop you'll get the result as if you do all the loops.
The difference with the approach that is described in the task, that here you always look at the last valid value. Not on the value that was probably removed.