You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Counting valleys deals with strings. One has to count the number of valleys and Hills in the given string and return the position of traveller at end w.r.t the start point.
3
+
'U' is treated as 'the traveller came across a hill' and 'D' denotes that he came across a valley.
4
+
5
+
Input is guranteed as a string with 'U', and 'D' with an integer having the value of length of input string.
6
+
7
+
Output should be a single integer that denotes the number of valleys traveller walked through during his hike.
0 commit comments