Find the value of $\int_0^1f(x)dx$ 
If $$f(x)=\binom{n}{1}(x-1)^2-\binom{n}{2}(x-2)^2+\cdots+(-1)^{n-1}\binom{n}{n}(x-n)^2$$
Find the value of $$\int_0^1f(x)dx$$

I rewrote this into a compact form.
$$\sum_{k=1}^n\binom{n}{k}(x-k)^2(-1)^{k-1}$$
Now,
$$\int_0^1\sum_{k=1}^n\binom{n}{k}(x-k)^2(-1)^{k-1}dx$$
$$=\sum_{k=1}^n\binom{n}{k}\frac{(1-k)^3}{3}(-1)^{k-1}-\sum_{k=1}^n\binom{n}{k}\frac{(-k)^3}{3}(-1)^{k-1}$$
$$=\sum_{k=1}^n\binom{n}{k}\frac{(1-k)^3}{3}(-1)^{k-1}+\sum_{k=1}^n\binom{n}{k}\frac{k^3}{3}(-1)^{k-1}$$
After this, I took $\dfrac13$ common and did some simplifications but nothing useful came out.
Any help is greatly appreciated.

Solution 1. Here is another approach. Consider the shift operator $\Delta$ defined for functions on $\mathbb{R}$ by
$$ \Delta f(x) = f(x-1). $$
Then
\begin{align*}
\sum_{k=1}^{n} (-1)^{k-1} \binom{n}{k} (x-k)^2
&= \sum_{k=1}^{n} (-1)^{k-1} \binom{n}{k} \Delta^k x^2 \\
&= [\operatorname{id} - (\operatorname{id} - \Delta)^n] x^2.
\end{align*}
Here, $\operatorname{id}$ is the identity operator on functions, i.e., $\operatorname{id} f(x) = f(x)$. Now the crucial observation is as follows:

The backward difference operator $D = \operatorname{id} - \Delta$, when applied to a polynomial, results in another polynomial with degree decreased by at least one.

Intuitively, this is because $D$ behaves similar to the differential operator $\frac{\mathrm{d}}{\mathrm{d}x}$. In particular, when $n \geq 3$, it follows that $D^n x^2 = 0$. Hence it follows that
$$ \sum_{k=1}^{n} (-1)^{k-1} \binom{n}{k} (x-k)^2 = x^2 \qquad\text{for}\quad n \geq 3. $$
Now the rest computation is straightforward.

Solution 2. Here is yet another approach. Define the coefficient extraction operator $[x^n]$ by
$$ [x^n]\sum_{k=0}^{\infty} a_k x^k = a_k. $$
Note that $[x^n]$ is linear. Furthermore, we may rewrite the integral using this operator as:
\begin{align*}
\int_{0}^{1} f(x) \, \mathrm{d}x
&= \int_{0}^{1} \left( \sum_{k=1}^{n} (-1)^{k-1} \binom{n}{k} (x-k)^2 \right) \, \mathrm{d}x \\
&= \int_{0}^{1} \left( \sum_{k=1}^{n} (-1)^{k-1} \binom{n}{k} 2 [s^2] e^{(x-k)s} \right) \, \mathrm{d}x \\
&= 2 [s^2] \int_{0}^{1} \left( \sum_{k=1}^{n} (-1)^{k-1} \binom{n}{k} e^{(x-k)s} \right) \, \mathrm{d}x \\
&= 2 [s^2] \int_{0}^{1} e^{xs} \left( 1 - (1 - e^{-s})^n \right) \, \mathrm{d}x \\
&= 2 [s^2] \left( \frac{e^s - 1}{s} \left( 1 - (1 - e^{-s})^n \right) \right).
\end{align*}
Then, using the fact that
$$ \frac{e^s - 1}{s} = 1 + \frac{s}{2} + \frac{s^2}{6} + \mathcal{O}(s^3) $$
and
$$ 1-(1-e^{-s})^n = \begin{cases}
1 - s + \frac{s^2}{2} + \mathcal{O}(s^3), & n = 1, \\
1 - s^2 + \mathcal{O}(s^3), & n =2, \\
1  + \mathcal{O}(s^3), & n \geq 3,
\end{cases} $$
we can easily conclude that
$$ \int_{0}^{1} f(x) \, \mathrm{d}x = \begin{cases}
\frac{1}{3}, & n = 1 \text{ or } n \geq 3, \\
-\frac{5}{3}, & n = 2.
\end{cases} $$
