You are viewing a single comment's thread. Return to all comments →
My golang solution
func countingValleys(steps int32, path string) int32 { // Write your code here var m int32 = 0 l:=0 for _,v := range path{ if v == 'D'{ l-- }else{ if l==-1{ m++ } l++ } } return m }
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 →
My golang solution