Explanation:
So f'(x)=0:
x^2 - x - 2 = 0
(x-2)(x+1)=0
x=-1, 2
So we need to find the value of f at those critical points and also at the endpoints of the interval
f(-1)=-2-3+12+1=8
f(2)=16-12-24+1=-19
f(-2)=-16-12+24+1=-3
f(3)=54-27-36+1=-8
so the max is 8 and the min is -19