maxall exercise (tail recursive case)