Analytical Interview Questions
Home C/C++ JAVA Google Microsoft Data structures Puzzles Google
Pages
Resume Tips

 

Question

You have someone working for you for seven days and you have one gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker?

Solution

As 7 = 1 + 2 + 4, this implies there are only 2 divisions (cuts).

Day 1: Give [1] and you have [2+4]

Day 2: Give [2] and take back [1]. You have [1+4]

Day 3: Give [1+2] and you have [4]

Day 4: Give [4] and take back [1+2]. You have [1+2].

Day 5: Give [1+4] and you have [2]

Day 6: Give [2+4] and take back [1]. You have [1]

Day 7: Give [1+2+4] and you have nothing!

The same trick can be applied to:

15 Days = 1 + 2 + 4 + 8

31 Days = 1 + 2 + 4 + 8 + 16

And so on.

The main point of division is:

1 = 2^0

2 = 2^1

4 = 2^2

8 = 2^3

16= 2^4

And so on...

 

Recommended Materials

 

Keywords: