Hill Hike dynamic programming