For each step in Gary’s journey Add the current step to either the up or down counts If sea_level is true: If Gary moves down: Record an additional valley Else: If down_steps == up_steps sea_level = true