In a kingdom far far away, the King decided that the time
has come to find a husband for his princess daughter. The
King wanted to find a worthy lad for his princess, so he
promised to give his daughter away to the first young (or
old) man who would solve the puzzle that has stumped the
best of his court mathematicians for years. The puzzle is
very simple: in a palace, there are 25 rooms arranged in a
square--5 rows of rooms with 5 rooms in each row. In every
room there is a light switch which not only switches on/off
the light in that room, but also switches the lights in the
adjacent rooms--the room to the right, to the left, the
room above and the room below. Initially, all of the
lights are turned off. The goal is to turn the lights on
in every room of the palace.

Answers were Sorted based on User's Feedback



In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / ananya

X1X1X Superman,if u on 4 lights,then switches of the
10101 room denoted by X will not be turned on.
X1X1X
10101
X1X1X
.........................................................
U have to on 7 lights

The room of which light need to on is indicated by 0,

11011
01110
11011
01110
11011

Is This Answer Correct ?    37 Yes 5 No

In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / daniela

1 1 0 0 0
1 1 0 1 1
0 0 1 1 1
0 1 1 1 0
0 1 1 0 1

1 - switch on the light

Is This Answer Correct ?    8 Yes 3 No

In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / max

00600
10003
00500
20004
00700

Need to switch on 7 lights.

Is This Answer Correct ?    6 Yes 3 No

In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / pradip biswas

11111
10110
11111
11111
10110


0 indicates rooms you need to switch lights on... Its simple....

Is This Answer Correct ?    2 Yes 0 No

In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / alphy

only 1 light need to switch on, gradually the remaining all
will become on.

1 0 0 0 0
0 0 0 0 0
0 0 0 0 0---->
0 0 0 0 0
0 0 0 0 0

1 1 0 0 0
1 0 0 0 0
0 0 0 0 0---->
0 0 0 0 0
0 0 0 0 0

1 1 1 0 0
1 1 0 0 0
1 0 0 0 0----> like this
0 0 0 0 0
0 0 0 0 0

Is This Answer Correct ?    12 Yes 11 No

In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / tirupathi

X1X1X Superman,if u on 4 lights,then switches of the
10101 room denoted by X will not be turned on.
X1X1X
10101
X1X1X
.........................................................
U have to on 7 lights

The room of which light need to on is indicated by 0,

11011
01110
11011
01110
11011


Hi Ananya can you please explain this.

Is This Answer Correct ?    1 Yes 1 No

In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / sharmesh kumar

Hi Ananya,

I have doubt in your solution as well.

.........................................................
U have to on 7 lights

The room of which light need to on is indicated by 0,

11011
01110
11011
01110
11011

.........................................................
Suppose the room are numbered like
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

Now,if room no. 3,6,10 were switched-on, this will switch-on
lights in the room (2,8,4);(1,7,11);(5,9,15) in that order
respectively. Now when 13th room light is lit, it will
switch-off the light of room no. 8 as well. So, if we follow
your approach, at last the lights from room no.s 8 & 18 will
be OFF.

Is This Answer Correct ?    1 Yes 1 No

In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / dolly

7 is the correct answer which is provided by Md.Answer no:5

Is This Answer Correct ?    0 Yes 0 No

In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / pradip biswas

Sorry I did not understand the problem before ... My solution is wrong.

Is This Answer Correct ?    0 Yes 0 No

In a kingdom far far away, the King decided that the time has come to find a husband for his princ..

Answer / guest

Switch on the first room light

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Puzzles Interview Questions

Four men - Abraham, Bobby, Clinton and Denial - are standing in a straight line. 1. One man is fair, handsome and unscarred. 2. Two men who are not fair, are each standing next to Abraham. 3. Bobby is the only man standing next to exactly one handsome man. 4. Clinton is the only man not standing next to exactly one scarred man. Who is fair, handsome and unscarred?

5 Answers  


In the village called TALAJA, only three TV channels are available - Moon Plus, Mony and Mee TV. Out of 4000 TV viewers in the village, 1500 watch Moon TV, 2000 watch Mony and 2500 watch Mee TV. Amongst these, 500 viewers watch Moon Plus and Mony, 800 watch Moon Plus and Mee TV, and 1000 watch Mony and Mee TV. How many viewers watch all three channels?

2 Answers  


how do you plan to achieve these goals?

1 Answers  


what is Next number in the series is 1 , 2 , 4 , 13 , 31 , 112 , ?

10 Answers   Infosys,


Given an N × N array of positive and negative integers, find the sub-rectangle with the largest sum. The sum of a rectangle is the sum of all the elements in that rectangle. In this problem the sub-rectangle with the largest sum is referred to as the maximal sub-rectangle. A sub-rectangle is any contiguous sub-array of size 1 × 1 or greater located within the whole array. Input Format: First line contains the size of matrix. Followed by n lines and each line contain n integers separated by space. Output format: Single integer which represents maximum sum of rectangle. Sample Input: 4 0 -2 -7 0 9 2 -6 2 -4 1 -4 1 -1 8 0 -2 Sample Output: 15

1 Answers   Infosys, TCS,






15 people--each has to pay Rs.20.. 20 people--each has to pay Rs.18.. for 40 people--how much has to pay

6 Answers  


why the students are lag for answering this type of questions?

5 Answers   Honeywell,


What is the area of the triangle ABC with A(e,p) B(2e,3p) and C(3e,5p)? where p = PI (3.141592654)

2 Answers  


You are in a boat with your mother and wife. Suddenly you are forced to drop somebody into water due to boat overloading. You cannot drop yourself. Whom will you drop?

29 Answers   IIM, Keyence,


At the Party: 1. There were 9 men and children. 2. There were 2 more women than children. 3. The number of different man-woman couples possible was 24. Note that if there were 7 men and 5 women, then there would have been 35 man-woman couples possible. Also, of the three groups - men, women and children - at the party: 4. There were 4 of one group. 5. There were 6 of one group. 6. There were 8 of one group. Exactly one of the above 6 statements is false. Can you tell which one is false? Also, how many men, women and children are there at the party?

2 Answers  


Sarika multiplied 414 by certain number and obtained 69958 as the answer. But she found that there is some error in the answer - both the 9s in the answer are wrong and all the other digits are correct. Can you find the correct answer?

5 Answers   PayPal,


there r 100 people who buys juice if v take 500 random sample we find 75 people who buys juice then how many random sample they need 2 find remaining 25 buyers

7 Answers   TCS,


Categories