Given a cubic array made up of NxNxN smaller cubes: the cubic array is N cubes wide, N cubes deep and N cubes high.

Question: How many cubes are on the surface of the array.

Answer:

There are N3 cubes total. If you can calculate how many cubes are hidden you can answer this questions. The number of hidden cubes is simply a number of cubes with sides (N-2)x(N-2)x(N-2). ie. (N-2)3.

Thus, the answer is

N3 - (N-2)3.


Bonus question:

Calculate number of 4D hypercubes on the surface of NxNxNxN hypercubic array







Answers and Comments