Given a string of 'U' (up) and 'D' (down) representing steps, count the number of mountains (sequences starting at sea level, going above, and returning) and valleys (sequences going below sea level…
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.