7 kyu

Counting Valleys

843 of 1,881Valefar

Description:

You need count how many valleys you will pass.

Start is always from zero level.

Every time you go down below 0 level counts as an entry of a valley, and as you go up to 0 level from valley counts as an exit of a valley.

One passed valley is equal one entry and one exit of a valley.

s='FUFFDDFDUDFUFUF'
U=UP
F=FORWARD
D=DOWN

To represent string above

(level 1)  __
(level 0)_/  \         _(exit we are again on level 0)
(entry-1)     \_     _/
(level-2)       \/\_/

So here we passed one valley

Algorithms
Strings

Stats:

CreatedOct 18, 2019
PublishedOct 18, 2019
Warriors Trained3947
Total Skips70
Total Code Submissions8101
Total Times Completed1881
JavaScript Completions843
Haskell Completions43
C++ Completions273
Python Completions694
Rust Completions59
RISC-V Completions14
C Completions41
Total Stars44
% of votes with a positive feedback rating94% of 372
Total "Very Satisfied" Votes337
Total "Somewhat Satisfied" Votes28
Total "Not Satisfied" Votes7
Total Rank Assessments22
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Valefar Avatar
  • PG1 Avatar
  • donaldsebleung Avatar
  • JohanWiltink Avatar
  • TheEyesightDim Avatar
  • Voile Avatar
  • albertogcmr Avatar
  • macambira Avatar
Ad