When approaching a problem like this, the first step is determining the volume of the box you need to fill.
Volume of a rectangular box is: V = l * w * h ---> so V = 2ft * 2ft * 1ft = 4 ft3
(aka 24in * 24in * 12in = 6912 in3)
The next step is determining the volume of the cubes you'll use to fill your box:
Volume of a cube: V = s3 ---> V = (2 in)3 = 8 in3
Then your final step would be dividing the volume of your box by the volume of each cube to determine the number of cubes needed.
6912 in3 / 8in3 = 864 cubes.
When given problems with different units, make sure to convert all your numbers to the same units to stay consistent.