Created
August 6, 2021 08:01
-
-
Save OlivierJM/e46cdcd5378f4a4cf9eb719e2b426195 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function countingValleys(steps, path) { | |
for (let index = 0; index < steps; index++) { | |
const currentStep = path[index]; | |
const nextStep = path[index + 1]; | |
let downHill = 0; | |
let upHill = 0; | |
if (currentStep + nextStep !== "UD") { | |
if (currentStep === nextStep) { | |
// we are either going downhill or uphill | |
// now check if currentStep is D which means downhil, if U then upHill | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment