You are viewing a single comment's thread. Return to all comments →
def countingValleys(n, s): g=0 count=0 for i in s: if i =='U': g+=1 else: g-=1 if g==0 and i=='U': count+=1 return 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 →
had similar idea in python