• + 13 comments

    The problem statement says consecutive steps below sea level. Does this solution work for 4 DUDU or does it return 1? Based on the problem statement that input should return 0.

    Edit: I removed the condition to check that the previous step was also below sea level and all the tests passed. However, this no longer matches the definition of a valley "consecutive steps below sea-level"... unless I am misunderstanding the implied multiplicity in the word consecutive.