You are viewing a single comment's thread. Return to all comments →
// Write your code here int ans = 0,level=0; for(char c: path.toCharArray()) { if(c=='U') level+=1; else level-=1; if(level==0 && c=='U') ans++; } return ans;
} `
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 →
} `