Suppose $X$ is a connected CW complex with $\dim X = n$ and $Y$ is CW-complex which is $n$-connected. Is it true that the set of homotopy classes of maps $f \colon X \to Y$ is trivial, i.e. $[X,Y]=\{[\text{constant map}]\}$.
A second related question. Suppose $X$ is as above and $Y$ a CW complex. Can I say that $[X,Y] \cong [X,Y_n]$ (bijection of sets) where $Y_n$ is the $n$-skeleton of $Y$. If not, what goes wrong?
(converting above comment to answer; will provide more details if needed)
For the first question, yes by the cellular approximation theorem. For the second question, no; consider $S^1$ mapping to the disk $D^2$ (obtained by gluing a 2-cell to the circle by the identity on the boundary). It is true that $[X,Y]=[X,Y^{n+1}]$, also by cellular approximation. Think of the $+1$ as accounting for homotopies (crossing with a 1-dimensional interval).