You have four colored cubes. Each side of each cube is a single color, and there are four colors: blue (B), red (R), green (G) and yellow (Y) Describing the six faces as front, back, left, right, top, bottom, the cube colors are:
Cube Front Back Left Right Top Bottom
1 R B G Y B Y
2 R G G Y B B
3 Y B R G Y R
4 Y G B R R R
The objective is to find ways to stack the four cubes as a vertical column so that each side of the column is showing all four colors.
In a compiled language of your choice, need a program to find all successful permutations.


JureRank #2,128 · 670 reputationPosted Nov 6, 2010, 5:35 PM EDT
The trick is to think just about cube's vertical faces. I named groups of them "rings" and there are 3 such groups (around, over, over sideways), but you should also consider flipping the cube on the head (mirrored rings), so 6 rings in total per cube. Basically, every side is at the bottom/top/... once and there are 6 sides.
Then you should also think about rotating the cube around its Y-axis. I named such rotations "shifts", since the group (or list) of vertical faces shifts. There are 4 of them. But we can forget about 1st cube, because rotating it has no effect.
So that's 82944 unique stacks (6 sides, 4 possible shifts, 1st cube doesn't need to shift -> 6^4 * 4^3). Both solutions were found instantly (no delay noticed).
Suthish NairRank #92 · 22.8K reputationPosted Nov 1, 2010, 2:02 AM EDT
DO NOT include any compiled binary code (.exe ) as it could be rejected by mail clients?
Outsourcing job?
Manikavelu VelayuthamRank #413 · 6K reputationPosted Nov 1, 2010, 2:06 AM EDT
Actually it was a question asked in an interview.
Suthish NairRank #92 · 22.8K reputationPosted Dec 9, 2010, 6:18 PM EST
"DO NOT include any compiled binary code (.exe ) as it could be rejected by mail clients?"
Mahesh ChandRank #1 · 393.3K reputationPosted Dec 10, 2010, 3:36 AM EST
Manikavelu VelayuthamRank #413 · 6K reputationPosted Dec 11, 2010, 3:45 AM EST
Suthish NairRank #92 · 22.8K reputationPosted Dec 11, 2010, 10:24 AM EST
Thomas McNeely4 reputationPosted Jan 26, 2011, 7:57 PM EST
I think you should post crap like this on answers.yahoo.com rather that fill this forum with senseless babble.
Suthish NairRank #92 · 22.8K reputationPosted Jan 26, 2011, 9:52 PM EST
Did you really read the thread, before posting your reply.
Or is this a kind of spamming?
Sam HobbsRank #107 · 20.5K reputationPosted Jan 27, 2011, 11:14 AM EST