This is difficult to describe in words, so read this carefully, lest there be any confusion. You have a normal six sided cube. i give you six different colors that you can paint each side of the cube with (one color to each side). How many different cubes can you make?
Different means that the cubes can not be rotated so that they look the same. This is important! If you give me two cubes and I can rotate them so that they appear identical in color, they are the same cube.
Solution
Let X be the number of “different” cubes (using the same definition as in the problem). Let Y be the number of ways you can “align” a given cube in space such that one face is pointed north, one is east, one is south, one is west, one is up, and one is down. (We’re on the equator.) Then the total number of possibilities is X * Y. Each of these possibilities “looks” different, because if you could take a cube painted one way, and align it a certain way to make it look the same as a differently painted cube aligned a certain way, then those would not really be different cubes. Also note that if you start with an aligned cube and paint it however you want, you will always arrive at one of those X * Y possibilities.
How many ways can you paint a cube that is already “aligned” (as defined above)? You have six options for the north side, five options for the east side, etc. So the total number is 6! (that’s six factorial, or 6 * 5 * 4 * 3 * 2 * 1). Note that each way you do it makes the cube “look” different (in the same way the word is used above). So 6! = X * Y.
How many ways can you align a given cube? Choose one face, and point it north; you have six options here. Now choose one to point east. There are only four sides that can point east, because the side opposite the one you chose to point north is already pointing south. There are no further options for alignment, so the total number of ways you can align the cube is 6 * 4.
Remember, Y is defined as the number of ways you can align the cube, so Y = 6 * 4. This gives us 6! = X * 6 * 4, so X = 5 * 3 * 2 * 1 = 30.
2026 Update: 3D Geometry in Coding Interviews
3D geometry puzzles remain asked at Apple hardware, Google, and Microsoft — particularly for roles involving computer graphics, robotics, or spatial data. The painted cube problem tests systematic enumeration by position type, a skill that transfers to voxel data structures, 3D game engines, and medical imaging.
The systematic approach: An N×N×N cube has four types of unit cubes: corners (always 8, 3 faces painted), edges (12 × (N-2), 2 faces), face centers (6 × (N-2)², 1 face), interior ((N-2)³, 0 faces).
def cube_paint_count(n):
"""Count unit cubes by number of painted faces in an N×N×N cube."""
if n == 1:
return {6: 1} # The single cube has all 6 faces painted
if n < 2:
return {}
return {
3: 8,
2: 12 * (n - 2),
1: 6 * (n - 2) ** 2,
0: (n - 2) ** 3
}
for n in [3, 4, 10]:
counts = cube_paint_count(n)
total = sum(counts.values())
print(f"N={n}: {counts}, total={total} (expected {n**3})")
2026 variant: “Given a 3D voxel grid, write a function that marks all boundary voxels (those with at least one exposed face). What is the minimum number of paint operations needed to color the outside?” Same structure, applied to mesh processing.
Still asked at (2026): Apple hardware, Google (new grad SWE for spatial reasoning), Microsoft (HoloLens / Mixed Reality team interviews).
💡Strategies for Solving This Problem
Combinatorics and Symmetry
This appeared at Google. It's about counting with symmetries - requires Burnside's lemma or Pólya enumeration theorem. Tests mathematical maturity.
The Problem
You have a cube and 6 different colors. Paint each face a different color. How many distinct cubes can you make?
Key: "Distinct" means cubes that can't be rotated into each other are different.
Naive Answer: 6!
If we ignore rotations, there are 6! = 720 ways to assign colors to faces.
But many of these are the same cube rotated.
The Real Answer: 30
Using Burnside's lemma: Count configurations fixed by each rotation, then average.
A cube has 24 rotational symmetries (including identity). Using Burnside:
Distinct cubes = 6! / 24 = 720 / 24 = 30
Why 24 Rotations?
Cube rotation group has 24 elements:
- 1 identity (no rotation)
- 6 face rotations (90° and 270° around 3 axes)
- 3 face rotations (180° around 3 axes)
- 8 vertex rotations (120° and 240° around 4 body diagonals)
- 6 edge rotations (180° around 6 edge-to-edge axes)
Total: 1 + 6 + 3 + 8 + 6 = 24
Burnside's Lemma
Number of distinct objects = (1/|G|) × Σ |Fix(g)|
Where:
- |G| = size of symmetry group (24 for cube)
- Fix(g) = colorings unchanged by symmetry g
For all-different colors, only identity fixes anything, so:
Distinct = (1/24) × (6! + 0 + 0 + ... ) = 720/24 = 30
At Google
I initially said 720. Interviewer asked "What if you can rotate the cube?" That's when I realized it's about symmetries. Had to derive the rotation count, then apply Burnside.