Consider the simplest algorithm. At any given moment, take a step in the direction that takes you higher. The risk with this method is if you happen to start near the lower hill, you’ll end up at the top of that lower hill, not the top of the tallest hill.