Stopped at accumulated min algorithm