Easy15 pts
Counting Valleys
Steps: U and D. Start at 0. A valley is a seq of steps below 0 ending at 0. Count valleys.
Input
n, then string of n U/D.
Output
Number of valleys.
Sample
8 UDDDUDUU
Expected
1
Loading editor…
Output
No output yet. Run your code to see results.