Solution
Note: it is advisable to try solving the puzzle by yourself first and then continue to the solution part.
All possible dates that can be present in a month are shown below.
01 02 03 04 05 06
07 08 09 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31
The dates to be noted here are 11 and 22.
It implies that we need to have 1 and 2 on both the cubes to represent the dates 11 and 22. Now, we can observe that 0 comes in combination with 1, 2, 3, 4, 5, 6, 7, 8, 9. In total, there are nine numbers. The maximum possible number to have on a cube is only 6. Therefore, we need to have 0 on both the cubes. Let’s see the current state of the cubes.
C1: 0 1 2
C2: 0 1 2
There are six spaces left in total to add other numbers, and the numbers that we need to add are 3 4 5 6 7 8 9. There are seven numbers still left out, and we only have six empty spaces. This is the tricky part of this puzzle. Now, try solving this problem.
The number 6, when seen upside down, looks like 9 as inverting the cubes is allowed. So we can add either 6 or 9 in any of the cubes. We are adding 6 here. The state of the cubes now will be:
C1: 0 1 2 3 4 5
C2: 0 1 2 6 7 8
You can see that it is possible to represent every date using these combinations. So the output will be
012345012678
Note that this is not the only answer possible. 9 can also be chosen instead of 6 on the cubes. Or the order of selecting the numbers can alter the output as well.
Check out this problem - 8 Queens Problem
Frequently Asked Questions
Do I need to memorize all the puzzles?
No, when you try solving a puzzle yourself, it gets stuck in your memory for a long time as you have struggled to solve it. Even if you couldn’t solve it yourself, you won’t forget it for a long time as you realize the mistakes you made while solving it.
Why are puzzles important?
Puzzles enhance your ability to think. It also improves your problem-solving skills. You will have to apply your mind to solve a puzzle, so it’s also a good exercise for the mind. You will improve your logical thinking and reasoning ability by solving puzzles.
Are puzzles asked in the interview of IT companies?
Many tech giants like Google, Microsoft, etc., ask the puzzles in the interview process as they want to check your logical thinking.
Is the result given here the only possible output?
No, there can be different results based on the order of the numbers taken.
Why are there only six numbers on each cube?
Each cube has only six faces. So, each cube can have only six digits.
Conclusion
We have extensively discussed the Arrange Cubes puzzle.
Logical Puzzles:
Pattern Based Puzzles:
Recommended Readings:
Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Coding Ninjas Studio.
Also check out some of the Guided Paths on topics such as Interview Puzzles, Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.
Happy Learning!!!