In this reposotory you will find some exercises's HackerRank but first I invite you to try resolve them. Good luck!!
Use collections where look for pairs in a list.
Example: n = 7 ar = [1,2,1,2,1,3,2]
The number of pairs is 2.
Use loop for to determinate level dependig character U/D uphill or downhill. Determinate number of valleys. A valley is a sequence of consecutive steps below sea level, starting with a step down from sea level and ending with a step up to sea level.
Example
steps = 8 path = [UDDDUDUU]
_/\ _
\ /
\/\/
Answer: 1 valley