Solution (source code)

= Solution

The recurrence becomes
$$
d_n=-2d_{n-1}-d_{n-2},
\qquad d_0=1,\quad d_1=-2.
$$
Its characteristic <polynomial> is
$$
r^2+2r+1=(r+1)^2.
$$
Therefore $d_n=(\alpha+\beta n)(-1)^n$. The initial conditions give $\alpha=1$ and $\beta=1$, so
$$
\boxed{d_n=(-1)^n(n+1)}.
$$