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