You are viewing a single comment's thread. Return to all comments →
Python 3 solution
Just counting how many times I hit the sea level climbing up.
#!/bin/python3 import sys def countingValleys(n, steps): seaLevel = valley = 0 for step in steps: if step == 'U': seaLevel += 1 else: seaLevel -= 1 if step == 'U' and seaLevel == 0: valley += 1 return valley
Seems like cookies are disabled on this browser, please enable them to open this website
Counting Valleys
You are viewing a single comment's thread. Return to all comments →
Python 3 solution
Just counting how many times I hit the sea level climbing up.