We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Counting Valleys
- Discussions
Counting Valleys
Counting Valleys
Sort by
recency
|
190 Discussions
|
Please Login in order to post a comment
My Java solution:
My Java solution:
public static int countingValleys(int steps, String path) { int currentLevel = 0; char down = 'D'; int numberOfValleys = 0;
In C#
A valley is counted each time the hiker is at sea level and goes down. We just need to keep track of the current altitude to know that.
C++: