I got this question from professor, any hint would be helpful.
Let $k$ be a positive integer and let $X,Y$ be a partition of the vertex set of the graph $G$ such that $\chi(G[X])\le k$ and $\chi(G[Y])\le k$. Suppose $e(X,Y)\le k-1$. Then $\chi(G)\le k$.