the cube of integer can be written as the difference of two square
A more natural approach is to work out exactly which integers can be written as the difference of two squares, and then notice that all cubes are such.
So suppose $n=a^2-b^2$, with $n$, $a$ and $b$ all integers. Then we have $n=(a+b)(a-b)$. Setting $x=a+b$, $y=a-b$ we have $n=xy$ with $a=\frac{x+y}{2}$, $b=\frac{x-y}{2}$. Since $a$ and $b$ are integers, $x$ and $y$ must be of the same parity.
Thus if $n$ is a different of two squares, then it can be factorized into two integers of the same parity. Either the factors are both odd, in which case $n$ is odd, or the factors are both even, in which case $n$ is divisible by $4$. Conversely, if $n$ is odd then $n=1\cdot n=\left (\frac{n+1}{2}\right)^2-\left(\frac{n-1}{2}\right)^2$, while if $n$ is divisible by $4$ then $n=2\cdot \frac{n}{2}=\left (\frac{n+4}{4}\right)^2-\left (\frac{n-4}{4}\right)^2$.
So the integers which are a difference of two squares are precisely those which are either odd or a multiple of $4$ (in other words, those not congruent to $2$ mod $4$). Since the cube of an odd number is odd and the cube of an even number is divisible by $2^3=8$ and hence by $4$, every cube is a difference of two squares.
Beni just posted the first part, see NICHOMACHUS
That is the natural answer. However, far more numbers can be represented as the difference of two squares. $$ (n +1)^2 - n^2 = 2 n + 1, $$ $$ (n + 1)^2 - (n - 1)^2 = 4 n. $$ Put those together, all odd numbers and all multiples of 4 can be exressed as the difference of two squares, positive or negative $n$ allowed. A cube is either odd or a multiple of 8. The only numbers that are not the difference of two squares are $2 \pmod 4,$ also written $4n+2,$ also called twice an odd number. As a result, the homework exercise works equally well with cubes replaced by fourth powers or fifth powers or higher.
That is the answer I know. Using the formula $$1^3+...+n^3=\left(\frac{n(n+1)}{2} \right)^2 $$
There is another trick. For odd positive integers we have
$$ 2k+1=(k+1)^2-k^2$$
For multiples of $4$ we have
$$ (k+2)^2-k^2=4(k+1)$$
Since every cube is either an odd integer either a multiple of $4$ this proves the needed result.