Solution to the roller coaster challenge.