Step 1: Integrate by parts:
Take \(u = x^2\), \(dv = e^x dx\): \(\int x^2e^xdx = x^2e^x - 2\int xe^xdx\).
Again: \(\int xe^xdx = xe^x - e^x\).
\[ \int x^2e^xdx = x^2e^x - 2xe^x + 2e^x + c = e^x(x^2-2x+2) + c \]
So \(f(x) = x^2 - 2x + 2\).
Step 2: Minimise:
\(f(x) = (x-1)^2 + 1\), whose least value is \(1\) at \(x = 1\).
Check with \(f'(x) = 2x - 2 = 0\) at \(x=1\), and \(f''(x) = 2 > 0\).
Final Answer:
The minimum value of \(f(x)\) is \(1\), option (C).
\[ \boxed{1} \]