You are viewing a single comment's thread. Return to all comments →
function countingValleys(steps, path) { let i,temp=0,count=0; for(i=0; i<steps; i++){ if(path[i]==="D"){ temp--; }else{ if(temp==-1){ count++; } temp++; } } 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 →