Counting Valleys

Absolutely one of my favorite problems. The counting valleys problem is about a hiker who records his steps. The output must be to count the number of valleys the hiker walked through. Two things we had to keep in mind were: A mountain is a sequence of consecutive steps above sea level, starting with a step up from sea level and… Continue reading Counting Valleys