You are viewing a single comment's thread. Return to all comments →
def countingValleys(steps, path):
valley_count = 0 altitude = 0 for step in path: if step == 'U': altitude += 1 else: altitude -= 1 if altitude == 0 and step == 'U': valley_count += 1 return valley_count
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 →
def countingValleys(steps, path):