I would like to solve the following recurrence relation:
\begin{equation} d[n,k] = d[n-1,k] + d[n-1,k-1] + d[n-1,k-2]\ , \end{equation}
with the boundary conditions
\begin{cases} d[0,0] = 1\\ d[n,n] = d[n-1,n-2] & {\it if} & n > 0\\ d[n,m] = 0 & {\it if} & n< 0\ ||\ m<0\ ||\ m>n \ . \end{cases}