Table of contents
1.
Introduction
2.
Problem
3.
Solution
4.
Frequently Asked Questions
4.1.
Do I need to memorize all the puzzles?
4.2.
Why are puzzles important?
4.3.
Are puzzles asked in the interview of IT companies?
4.4.
Is the result given here the only possible output?
4.5.
Why are there only six numbers on each cube?
5.
Conclusion
Last Updated: Mar 27, 2024

Arrange Cubes

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?
Interview Puzzles

Introduction

A puzzle is a game or problem that trains our brain. Puzzles train our brains and help us develop problem-solving skills. We have discussed the Arrange Cubes puzzle in this article. After reading the problem statement, try solving the puzzle, then only move to the solution part. This way, you will understand the concept behind this puzzle. So let’s begin.

Problem

Alice has two cubes on his table. He arranges the two cubes every day to display the current day of the month. For example, if it is the 13th day of the month, the first cube will show 1, and the second cube will display 3.

You have to find out the digits printed on the faces of both the cubes, which makes it possible to display all the dates in a month. Sort the numbers in ascending order and then append the second cube’s numbers to the first cube’s numbers.

For example:

If the first and the second cube have the following numbers on their faces: 

First cube: 6 2 4 1 3 5 -> 123456

Second cube: 0 7 8 9 6 4 -> 046789

Then you can output the result as 123456046789

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!!!

Live masterclass