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