so, simply, get the volume of the cube, length * height * width, is a 6x6x6. and then get the volume of the sphere, and the volume of the cube "includes" the volume of the sphere, however, if you subtract the volume of the sphere, what's leftover, is the part that's outside the sphere, and inside the cube.
[tex]\bf \textit{volume of a cube}\\\\
V=lwh\quad
\begin{cases}
l=length\\
w=width\\
h=height\\
------\\
l=w=h=6
\end{cases}\implies V=6^3
\\\\\\
\textit{volume of a sphere}\\\\
V=\cfrac{4\pi r^3}{3}\quad
\begin{cases}
r=radius\\
-----\\
r=3
\end{cases}\implies V=\cfrac{4\pi \cdot 3^3}{3}[/tex]