<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8638087380797358882</id><updated>2024-09-05T12:15:33.199-07:00</updated><category term="4 quarts if water tech interview puzzle"/><category term="Microsoft Puzzle: Gold for 7 days of Work"/><category term="Prisoners and Four - hats."/><category term="Puzzle : Prisoners and Five - hats."/><category term="Puzzle : Prisoners and three hats"/><category term="Puzzle Weights interview"/><category term="Solutioin for gold for 7 days puzzle microsoft interview puzzle"/><category term="Solution to amazon puzzle: How to find the age of Children"/><category term="Solution: Puzzle : Prisoners and Five - hats."/><category term="amazon interview puzzle: Find age of children"/><category term="google interview puzzle 2 two eggs"/><category term="prisioners and three hats"/><category term="solution 4 quarts if water tech interview puzzle"/><category term="solution to weights puzzle"/><category term="solution two eggs puzzle google interview"/><title type='text'>interview-puzzles</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-1795060738603938597</id><published>2011-09-08T20:30:00.000-07:00</published><updated>2011-09-08T20:33:22.808-07:00</updated><title type='text'>Solution for calculating the distance</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Question:&amp;nbsp; http://good-interview-puzzles.blogspot.com/2011/09/calculate-distance.html&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;notranslate&quot;&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 4305px; word-spacing: -1px;&quot;&gt;It is given that the platoon and the last person moved with uniform speed. Also,&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 4406px; word-spacing: -1px;&quot;&gt;they both moved for the identical amount of time. Hence, the ratio of the distance&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 4508px; word-spacing: -1px;&quot;&gt;they covered - while person moving forward and backword - are equal.&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 4712px; word-spacing: -1px;&quot;&gt;Let&#39;s assume that when the last person reached the first person, the platoon&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 4813px; word-spacing: -1px;&quot;&gt;moved X meters forward.&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 5017px; word-spacing: -1px;&quot;&gt;Thus, while moving forward the last person moved (50+X) meters whereas the&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 5118px; word-spacing: -1px;&quot;&gt;platoon moved X meters&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;notranslate&quot;&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 645px; word-spacing: -1px;&quot;&gt;Similarly, while moving back the last person moved [50-(50-X)] X meters&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 747px; word-spacing: -1px;&quot;&gt;whereas the platoon moved (50-X) meters.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;notranslate&quot;&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 747px; word-spacing: -1px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 951px; word-spacing: -1px;&quot;&gt;Now, as the ratios are equal,&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 1052px; word-spacing: -2px;&quot;&gt;(50+X)/X = X/(50-X)&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 1154px; word-spacing: -3px;&quot;&gt;(50+X)*(50-X) = X*X&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 1357px; word-spacing: -1px;&quot;&gt;Solving, X=35.355 meters&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 1561px; word-spacing: -1px;&quot;&gt;Thus, total distance covered by the last person&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 1662px; word-spacing: -2px;&quot;&gt;= (50+X) + X&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 1764px; word-spacing: -1px;&quot;&gt;= 2*X + 50&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 1866px; word-spacing: -1px;&quot;&gt;= 2*(35.355) + 50&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 1968px; word-spacing: -1px;&quot;&gt;= 120.71 meters&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 2273px; word-spacing: -1px;&quot;&gt;Note that at first glance, one might think that the total distance covered by the&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 2374px; word-spacing: -1px;&quot;&gt;last person is 100 meters, as he ran the total lenght of the platoon (50 meters)&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 2476px; word-spacing: -1px;&quot;&gt;twice. TRUE, but that&#39;s the relative distance covered by the last person i.e.&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 2578px; word-spacing: -1px;&quot;&gt;assuming that the platoon is stationary&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;notranslate&quot;&gt;&lt;span class=&quot;a&quot; style=&quot;left: 663px; top: 5118px; word-spacing: -1px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt; &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/1795060738603938597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/09/solution-for-calculating-distance-it-is.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/1795060738603938597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/1795060738603938597'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/09/solution-for-calculating-distance-it-is.html' title='Solution for calculating the distance'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-2799890148803938183</id><published>2011-09-08T20:27:00.000-07:00</published><updated>2011-09-08T20:34:22.021-07:00</updated><title type='text'>calculate the distance</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;notranslate&quot;&gt;&lt;span class=&quot;a&quot; style=&quot;color: #555555; left: 663px; letter-spacing: -1px; top: 4362px; word-spacing: 2px;&quot;&gt;There is a 50m long army platoon marching ahead. The last person in the platoon&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;color: #555555; left: 663px; letter-spacing: -1px; top: 4464px; word-spacing: 2px;&quot;&gt;wants to give a letter to the first person leading the platoon. So while the platoon is&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;color: #555555; left: 663px; letter-spacing: -1px; top: 4565px; word-spacing: 2px;&quot;&gt;marching he runs ahead, reaches the first person and hands over the letter to him and&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;color: #555555; left: 663px; letter-spacing: -1px; top: 4667px; word-spacing: 2px;&quot;&gt;without stopping he runs and comes back to his original position.&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;color: #555555; left: 663px; letter-spacing: -1px; top: 4870px; word-spacing: 2px;&quot;&gt;In the mean time the whole platoon has moved ahead by 50m.&lt;/span&gt;&lt;span class=&quot;a&quot; style=&quot;color: #555555; left: 663px; letter-spacing: -1px; top: 5073px; word-spacing: 2px;&quot;&gt;The question is how much distance did the last person cover in that time. Assuming that &lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;ff8&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;a&quot; style=&quot;color: #555555; left: 663px; letter-spacing: -1px; top: 551px; word-spacing: 2px;&quot;&gt;he ran the whole distance with uniform speed.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;a&quot; style=&quot;color: #555555; left: 663px; letter-spacing: -1px; top: 551px; word-spacing: 2px;&quot;&gt;Solution is&amp;nbsp;&amp;nbsp; http://good-interview-puzzles.blogspot.com/2011/09/solution-for-calculating-distance-it-is.html &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;ff8&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/2799890148803938183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/09/calculate-distance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/2799890148803938183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/2799890148803938183'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/09/calculate-distance.html' title='calculate the distance'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-427730462847133848</id><published>2011-08-01T21:29:00.000-07:00</published><updated>2011-09-08T20:32:35.346-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Solution: Puzzle : Prisoners and Five - hats."/><title type='text'>Solution: Puzzle : Prisoners and Five - hats.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Question:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-five-hats.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-five-hats.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The solution&lt;br /&gt;
&lt;br /&gt;
Assuming that A wears a black hat.&lt;br /&gt;
&lt;br /&gt;
• If B wears a black hat as well, C can immediately tell that he is wearing a white hat after looking at the two black hats in front of him.&lt;br /&gt;
&lt;br /&gt;
• If B does not wear a black hat, C will be unable to tell the colour of his hat (since there is a black and a white). Hence, B can deduce from A&#39;s black hat and C&#39;s response that he (B) is not wearing a black hat (otherwise the above situation will happen) and is therefore wearing a white hat.&lt;br /&gt;
&lt;br /&gt;
This therefore proves that A must not be wearing a black hat.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/427730462847133848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisoners-and-five-hats.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/427730462847133848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/427730462847133848'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisoners-and-five-hats.html' title='Solution: Puzzle : Prisoners and Five - hats.'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-7194393492810207138</id><published>2011-08-01T21:28:00.000-07:00</published><updated>2011-08-01T21:29:33.179-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle : Prisoners and Five - hats."/><title type='text'>Puzzle : Prisoners and Five - hats.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Another different condition. only three prisoners and five hats (supposedly two black and three white) are involved. The three prisoners are ordered to stand in a straight line facing the front, with A in front and C at the back. They are told that there will be two black hats and three white hats. One hat is then put on each prisoner&#39;s head; each prisoner can only see the hats of the people in front of him and not on his own&#39;s. The first prisoner that is able to announce the colour of his hat correctly will be released. No communication between the prisoners is allowed. After some time, only A is able to announce (correctly) that his hat is white. Why is that so?&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Answer:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisoners-and-five-hats.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisoners-and-five-hats.html&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/7194393492810207138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-five-hats.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/7194393492810207138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/7194393492810207138'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-five-hats.html' title='Puzzle : Prisoners and Five - hats.'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-2819177474348525937</id><published>2011-08-01T21:26:00.000-07:00</published><updated>2011-08-01T21:27:08.716-07:00</updated><title type='text'>Solution:  Puzzle : Prisoners and Four - hats.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Question:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-four-hats.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-four-hats.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
There are two cases:&lt;br /&gt;
In first case, one of the three prisoners (in A, B, C) wears the single off-colour hat, thus the other two can easily deduce the colour of theirs. For example if A is single color then B can see that C and A have different color hats. From this he concludes that his color is not single so he shouts his color.&lt;br /&gt;
&lt;br /&gt;
In second case, the three prisoners wear hats of the same colour, while D wears the off-colour hat. After a while, all four prisoners should be able to deduce that, since none of the others was able to state the colour of his own hat, D must wear the off-colour hat.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/2819177474348525937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisoners-and-four-hats.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/2819177474348525937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/2819177474348525937'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisoners-and-four-hats.html' title='Solution:  Puzzle : Prisoners and Four - hats.'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-3604823787472871163</id><published>2011-08-01T21:25:00.000-07:00</published><updated>2011-08-01T21:26:46.607-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Prisoners and Four - hats."/><title type='text'>Puzzle : Prisoners and Four - hats.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
Now the same puzzle with different condition. Instead of two red and two blue hats there are 3 hats of one colour and only 1 hat of another, and the 3 prisoners can see each other i.e. A sees B &amp;amp; C, B sees A &amp;amp; C and C sees A &amp;amp; B. D again not to be seen and only there to wear the last hat.&lt;br /&gt;
&lt;br /&gt;
Answer:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisoners-and-four-hats.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisoners-and-four-hats.html&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/3604823787472871163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-four-hats.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/3604823787472871163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/3604823787472871163'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-four-hats.html' title='Puzzle : Prisoners and Four - hats.'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-7115723364396183985</id><published>2011-08-01T21:15:00.000-07:00</published><updated>2011-08-01T21:15:23.981-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="prisioners and three hats"/><title type='text'>solution: puzzle: prisioners and three hats</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Question:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-three-hats.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-three-hats.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Answer:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For the sake of explanation let&#39;s label the prisoners in line order A B and C. Thus B can see A (and his hat colour) and C can see A and B.&lt;br /&gt;
&lt;br /&gt;
The prisoners know that there are only two hats of each colour. So if C observes that A and B have hats of the same colour, C would deduce that his own hat is the opposite colour. However, If A and B have hats of different colours, then C can say nothing. The key is that prisoner B, after allowing an appropriate interval, and knowing what C would do, can deduce that if C says nothing the hats on A and B must be different. Being able to see A&#39;s hat he can deduce his own hat colour. (The fourth prisoner is irrelevant to the puzzle: his only purpose is to wear the fourth hat).&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/7115723364396183985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisioners-and-three.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/7115723364396183985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/7115723364396183985'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisioners-and-three.html' title='solution: puzzle: prisioners and three hats'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-4491965718138182220</id><published>2011-08-01T21:10:00.000-07:00</published><updated>2011-08-01T21:16:10.715-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle : Prisoners and three hats"/><title type='text'>Puzzle : Prisoners and three hats</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Four prisoners are arrested for a crime, but the jail is full and the jailer has nowhere to put them. He eventually comes up with the solution of giving them a puzzle so if they succeed they can go free but if they fail they are executed.&lt;br /&gt;
&lt;br /&gt;
The jailer puts three of the men sitting in a line. The fourth man is put behind a screen (or in a separate room). He gives all four men party hats . The jailer explains that there are two red and two blue hats. The prisoners can see the hats in front of them but not on themselves or behind. The fourth man behind the screen can&#39;t see or be seen by any other prisoner. No communication between the men is allowed.&lt;br /&gt;
&lt;br /&gt;
If any prisoner can figure out and say (out loud) to the jailer what colour hat he has on his head all four prisoners go free. The puzzle is to find how the prisoners can escape.&lt;br /&gt;
&lt;br /&gt;
Answer:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisioners-and-three.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/08/solution-puzzle-prisioners-and-three.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/4491965718138182220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-three-hats.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/4491965718138182220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/4491965718138182220'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/08/puzzle-prisoners-and-three-hats.html' title='Puzzle : Prisoners and three hats'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-2244120775583464725</id><published>2011-07-31T21:36:00.001-07:00</published><updated>2011-07-31T21:36:59.685-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Solution to amazon puzzle: How to find the age of Children"/><title type='text'>Solution to amazon puzzle: How to find the age of Children</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Question:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/07/amazon-interview-puzzle-find-age-of.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/amazon-interview-puzzle-find-age-of.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Answer :&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;First, determine all the ways that three ages can multiply together to get 72:&lt;br /&gt;
&lt;br /&gt;
72 1 1 (quite a feat for the bartender)&lt;br /&gt;
36 2 1&lt;br /&gt;
24 3 1&lt;br /&gt;
18 4 1&lt;br /&gt;
18 2 2&lt;br /&gt;
12 6 1&lt;br /&gt;
12 3 2&lt;br /&gt;
9 4 2&lt;br /&gt;
9 8 1&lt;br /&gt;
8 3 3&lt;br /&gt;
6 6 2&lt;br /&gt;
6 4 3&lt;br /&gt;
As the man says, that&#39;s not enough information; there are many possibilities. So the bartender tells him where to find the sum of the ages--the man now knows the sum even though we don&#39;t. Yet he still insists that there isn&#39;t enough info. This must mean that there are two permutations with the same sum; otherwise the man could have easily deduced the ages.&lt;br /&gt;
&lt;br /&gt;
The only pair of permutations with the same sum are 8 3 3 and 6 6 2, which both add up to 14 (the bar&#39;s address). Now the bartender mentions his &quot;youngest&quot;--telling us that there is one child who is younger than the other two. This is impossible with 8 3 3--there are two 3 year olds. Therefore the ages of the children are 6, 6, and 2.&lt;br /&gt;
&lt;br /&gt;
Pedants have objected that the problem is insoluble because there could be a youngest between two three year olds (even twins are not born exactly at the same time). However, the word &quot;age&quot; is frequently used to denote the number of years since birth. For example, I am the same age as my wife, even though technically she is a few months older than I am. And using the word &quot;youngest&quot; to mean &quot;of lesser age&quot; is also in keeping with common parlance. So I think the solution is fine as stated.&lt;br /&gt;
&lt;br /&gt;
In the sum-13 variant, the possibilities are:&lt;br /&gt;
11 1 1&lt;br /&gt;
10 2 1&lt;br /&gt;
9 3 1&lt;br /&gt;
9 2 2&lt;br /&gt;
8 4 1&lt;br /&gt;
8 3 2&lt;br /&gt;
7 5 1&lt;br /&gt;
7 4 2&lt;br /&gt;
7 3 3&lt;br /&gt;
6 6 1&lt;br /&gt;
6 5 2&lt;br /&gt;
6 4 3&lt;br /&gt;
&lt;br /&gt;
The two that remain are 9 2 2 and 6 6 1 (both products equal 36). The final bit of info (oldest child) indicates that there is only one child with the highest age. This cancels out the 6 6 1 combination, leaving the childern with ages of 9, 2, and 2.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/2244120775583464725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solution-to-amazon-puzzle-how-to-find.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/2244120775583464725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/2244120775583464725'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solution-to-amazon-puzzle-how-to-find.html' title='Solution to amazon puzzle: How to find the age of Children'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-5830165760151755213</id><published>2011-07-31T21:35:00.000-07:00</published><updated>2011-07-31T21:44:55.963-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="amazon interview puzzle: Find age of children"/><title type='text'>amazon interview puzzle: Find age of children</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&amp;nbsp; A man walks into a bar, orders a drink, and starts chatting with the bartender. After a while, he learns that the bartender has three children. &quot;How old are your children?&quot; he asks. &quot;Well,&quot; replies the bartender, &quot;the product of their ages is 72.&quot; The man thinks for a moment and then says, &quot;that&#39;s not enough information.&quot; &quot;All right,&quot; continues the bartender, &quot;if you go outside and look at the building number posted over the door to the bar, you&#39;ll see the sum of the ages.&quot; The man steps outside, and after a few moments he reenters and declares, &quot;Still not enough!&quot; The bartender smiles and says, &quot;My youngest just loves strawberry ice cream.&quot; How old are the children?&lt;br /&gt;
&amp;nbsp;A variant of the problem is for the sum of the ages to be 13 and the product of the ages to be the number posted over the door. In this case, it is the oldest that loves ice cream. Then how old are they?&lt;br /&gt;
&lt;br /&gt;
Answer:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/07/solution-to-amazon-puzzle-how-to-find.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/solution-to-amazon-puzzle-how-to-find.html&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/5830165760151755213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/amazon-interview-puzzle-find-age-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/5830165760151755213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/5830165760151755213'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/amazon-interview-puzzle-find-age-of.html' title='amazon interview puzzle: Find age of children'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-3867593305252137704</id><published>2011-07-31T21:29:00.001-07:00</published><updated>2011-07-31T21:37:34.783-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Solutioin for gold for 7 days puzzle microsoft interview puzzle"/><title type='text'>Solution for gold for 7 days puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Question:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/07/microsoft-puzzle-gold-for-7-days-of.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/microsoft-puzzle-gold-for-7-days-of.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The trick is not to try and how to cut in such a way to make 7 equal pieces but rather to make transactions with the worker. Make two cuts on the gold bar such that you have the following sizes of bars.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1/7, 2/7 and 4/7. For convenience sake, I would just refer to the bars as 1, 2 and 4.&lt;br /&gt;
&lt;br /&gt;
At the end of Day 1: Give Bar 1 (You- 2 and 4, Worker- 1)&lt;br /&gt;
&lt;br /&gt;
At the end of Day 2: Give Bar 2, Take back Bar 1 (You- 1 and 4, Worker- 2)&lt;br /&gt;
&lt;br /&gt;
At the end of Day 3: Give Bar 1 (You- 4, Worker- 1 and 2)&lt;br /&gt;
&lt;br /&gt;
At the end of Day 4: Give Bar 4, Take back Bar 1 and Bar 2 (You- 1 and 2, Worker- 4)&lt;br /&gt;
&lt;br /&gt;
At the end of Day 5: Give Bar 1 (You- 2, Worker- 1 and 4)&lt;br /&gt;
&lt;br /&gt;
At the end of Day 6: Give Bar 2, Take back Bar 1 (You- 1, Worker- 2 and 4)&lt;br /&gt;
&lt;br /&gt;
At the end of Day 7: Give Bar 1 (You- Empty, Worker- 1, 2 and 4)&lt;br /&gt;
&lt;br /&gt;
That should take care of everything.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/3867593305252137704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solutioin-for-gold-for-7-days-puzzle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/3867593305252137704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/3867593305252137704'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solutioin-for-gold-for-7-days-puzzle.html' title='Solution for gold for 7 days puzzle'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-4910840879988972406</id><published>2011-07-31T21:28:00.000-07:00</published><updated>2011-07-31T21:29:58.210-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Puzzle: Gold for 7 days of Work"/><title type='text'>Microsoft Puzzle: Gold for 7 days of Work</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Lets us consider someone working for you seven days. You have a Gold bar to pay him. You must pay the worker for their work 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? (Assuming equal amount of work is done during each day thus requiring equal amount of pay for each day).&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Answer:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/07/solutioin-for-gold-for-7-days-puzzle.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/solutioin-for-gold-for-7-days-puzzle.html&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/4910840879988972406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/microsoft-puzzle-gold-for-7-days-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/4910840879988972406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/4910840879988972406'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/microsoft-puzzle-gold-for-7-days-of.html' title='Microsoft Puzzle: Gold for 7 days of Work'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-7624804172620099753</id><published>2011-07-31T21:24:00.001-07:00</published><updated>2011-07-31T21:24:56.396-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="solution 4 quarts if water tech interview puzzle"/><title type='text'>Solution to 4 quarts of Water puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Question:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/07/4-quarts-of-water.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/4-quarts-of-water.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This question is very simple actually. Since we can’t hold 4 quarts in the 3 quart pail, we have to look to filling up the 5 quart pail with exactly 4 quarts. Lets count the steps as we move along&lt;br /&gt;
&lt;br /&gt;
1. Fill 3 quart pail ( 5p – 0, 3p – 3)&lt;br /&gt;
2. Transfer to 5 quart pail (5p – 3, 3p – 0)&lt;br /&gt;
3. Fill 3 quart pail ( 5p – 3, 3p – 3)&lt;br /&gt;
4. Transfer to 5 quart pail (5p – 5, 3p – 1)&lt;br /&gt;
5. Empty 5 quart pail (5p – 0, 3p – 1)&lt;br /&gt;
6. Transfer to 5 quart pail (5p – 1, 3p – 0)&lt;br /&gt;
7. Fill 3 quart pail ( 5p – 1, 3p – 3)&lt;br /&gt;
8. Transfer to 5 quart pail (5p – 4, 3p – 0) We are done!!!&lt;br /&gt;
&lt;br /&gt;
That was easy right. Now for those who are mathematical and need everything solved in terms of a formula, here comes a little more mathematical solution.&lt;br /&gt;
&lt;br /&gt;
Now the general steps are to fill up the 3 quart pail and keep transferring to the 5 quart pail (empty if full) until we hit 4 quarts. Therefore, the total amount of water we filled in the 3 quart pail must be equal to 4 more than a multiple of 5 (since we discard 5 quarts of water at a time). From this, we can derive this formula.&lt;br /&gt;
5n + 4 = 3m, where n and m are arbitrary positive integers&lt;br /&gt;
n represents the number of times we had to empty the 5 quart pail and m represents the number of times we had to fill up the 3 quart pail.&lt;br /&gt;
&lt;br /&gt;
Now all we have to do is solve for the lowest set of positive integer solutions for {n,m}. {1, 3} is the lowest set. Some of the other solutions are {4, 8}, {7, 13}, {10, 18} and so on.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/7624804172620099753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solution-to-4-quarts-of-water-puzzle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/7624804172620099753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/7624804172620099753'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solution-to-4-quarts-of-water-puzzle.html' title='Solution to 4 quarts of Water puzzle'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-1962738103803342760</id><published>2011-07-31T21:23:00.000-07:00</published><updated>2011-07-31T21:25:20.190-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="4 quarts if water tech interview puzzle"/><title type='text'>4 quarts of Water</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&amp;nbsp; If you had an infinite supply of water and a 5 quart and 3 quart pails, how would you measure exactly 4 quarts? and What is the least number of steps you need?&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/07/solution-to-4-quarts-of-water-puzzle.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/solution-to-4-quarts-of-water-puzzle.html&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/1962738103803342760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/4-quarts-of-water.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/1962738103803342760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/1962738103803342760'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/4-quarts-of-water.html' title='4 quarts of Water'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-5254699505505876202</id><published>2011-07-31T21:11:00.000-07:00</published><updated>2011-07-31T21:11:57.591-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="solution two eggs puzzle google interview"/><title type='text'>Solution to Google Puzzle: Two Eggs Puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Question:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/07/google-puzzle-two-2-egg-puzzle.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/google-puzzle-two-2-egg-puzzle.html&lt;/a&gt;&lt;br /&gt;
Answer :&lt;br /&gt;
&lt;br /&gt;
Let x be the answer we want, the number of drops required.&lt;br /&gt;
&lt;br /&gt;
So if the first egg breaks maximum we can have x-1 drops and so we must always put the first egg from height x. So we have determined that for a given x we must drop the first ball from x height. And now if the first drop of the first egg doesn’t breaks we can have x-2 drops for the second egg if the first egg breaks in the second drop.&lt;br /&gt;
&lt;br /&gt;
Taking an example, lets say 16 is my answer. That I need 16 drops to find out the answer. Lets see whether we can find out the height in 16 drops. First we drop from height 16,and if it breaks we try all floors from 1 to 15.If the egg don’t break then we have left 15 drops, so we will drop it from 16+15+1 =32nd floor. The reason being if it breaks at 32nd floor we can try all the floors from 17 to 31 in 14 drops (total of 16 drops). Now if it did not break then we have left 13 drops. and we can figure out whether we can find out whether we can figure out the floor in 16 drops.&lt;br /&gt;
&lt;br /&gt;
Lets take the case with 16 as the answer&lt;br /&gt;
&lt;br /&gt;
1 + 15 16 if breaks at 16 checks from 1 to 15 in 15 drops&lt;br /&gt;
1 + 14 31 if breaks at 31 checks from 17 to 30 in 14 drops&lt;br /&gt;
1 + 13 45 .....&lt;br /&gt;
1 + 12 58&lt;br /&gt;
1 + 11 70&lt;br /&gt;
1 + 10 81&lt;br /&gt;
1 + 9 91&lt;br /&gt;
1 + 8 100 We can easily do in the end as we have enough drops to accomplish the task&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now finding out the optimal one we can see that we could have done it in either 15 or 14 drops only but how can we find the optimal one. From the above table we can see that the optimal one will be needing 0 linear trials in the last step.&lt;br /&gt;
&lt;br /&gt;
So we could write it as&lt;br /&gt;
&lt;br /&gt;
(1+p) + (1+(p-1))+ (1+(p-2)) + .........+ (1+0) &amp;gt;= 100.&lt;br /&gt;
&lt;br /&gt;
Let 1+p=q which is the answer we are looking for&lt;br /&gt;
&lt;br /&gt;
q (q+1)/2 &amp;gt;=100&lt;br /&gt;
&lt;br /&gt;
Solving for 100 you get q=14.&lt;br /&gt;
So the answer is: 14&lt;br /&gt;
Drop first orb from floors 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99, 100... (i.e. move up 14 then 13, then 12 floors, etc) until it breaks (or doesn&#39;t at 100).&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/5254699505505876202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solution-to-google-puzzle-two-eggs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/5254699505505876202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/5254699505505876202'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solution-to-google-puzzle-two-eggs.html' title='Solution to Google Puzzle: Two Eggs Puzzle'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-1976252471080397304</id><published>2011-07-31T21:09:00.000-07:00</published><updated>2011-07-31T21:13:14.834-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="google interview puzzle 2 two eggs"/><title type='text'>Google Puzzle: Two (2) Egg Puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
This Puzzle is asked by Google while they had an interview to a select student&lt;br /&gt;
&lt;br /&gt;
for their company:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* You are given 2 eggs.&lt;br /&gt;
* You have access to a 100-storey building.&lt;br /&gt;
* Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are identical.&lt;br /&gt;
* You need to figure out the highest floor of a 100-storey building an egg can be dropped without breaking.&lt;br /&gt;
* Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process&lt;br /&gt;
&lt;br /&gt;
Answer:&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/07/solution-to-google-puzzle-two-eggs.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/solution-to-google-puzzle-two-eggs.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/1976252471080397304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/google-puzzle-two-2-egg-puzzle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/1976252471080397304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/1976252471080397304'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/google-puzzle-two-2-egg-puzzle.html' title='Google Puzzle: Two (2) Egg Puzzle'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-7089786468589774116</id><published>2011-07-30T22:27:00.001-07:00</published><updated>2011-07-30T22:47:49.534-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="solution to weights puzzle"/><title type='text'>Solution to Weights Puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Here is the question:&lt;br /&gt;
&amp;nbsp;&lt;a href=&quot;http://good-interview-puzzles.blogspot.com/2011/07/weighing-in-harder-way.html&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/weighing-in-harder-way.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
[1] A = B: C has a heavy or light coin [18 cases]&lt;br /&gt;
[2] A &amp;lt; B: A has a light coin or B has a heavy coin [18 cases]&lt;br /&gt;
[3] A &amp;gt; B: A has a heavy coin or B has a light coin [18 cases]&lt;br /&gt;
&lt;br /&gt;
[1] Split C into groups of three coins: C1, C2, C3 and weigh C1 vs. C2.&lt;br /&gt;
&lt;br /&gt;
C1 = C2: C3 has a heavy or light coin [6 cases]&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Procedure 1:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;&amp;nbsp;Name the C3 coins c3a, c3b, c3c.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;c3a = c3b: if c3a &amp;lt;/&amp;gt; c3c, then c3c is the heavy / light coin.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;c3a &amp;lt; c3b: if c3a &amp;lt;/= c3c, then c3a is light / c3b is heavy.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;c3a &amp;gt; c3b: if c3a =/&amp;gt; c3c, then c3b is light / c3a is heavy.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
C1 &amp;lt; C2: C1 has a light coin or C2 has a heavy coin [6 cases]&lt;br /&gt;
C1 = C3: [C2&amp;gt;C1=C3] C2 has a heavy coin.&lt;br /&gt;
Apply &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Procedure 1&lt;/span&gt; to determine the odd one out.&lt;br /&gt;
C1 &amp;lt; C3: [C2&amp;gt;C1&amp;lt;C3] C1 has a light coin. Apply &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Procedure 1&lt;/span&gt; to determine the light coin.&lt;br /&gt;
C1 &amp;gt; C3: [C3&amp;gt;C1&amp;gt;C2] Impossible.&lt;br /&gt;
&lt;br /&gt;
C1 &amp;gt; C2: C1 has a heavy coin or C2 has a light coin [6 cases]&lt;br /&gt;
C1 = C3: [C1=C3&amp;gt;C2] C2 has a light coin. Apply &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Procedure 1&lt;/span&gt; to determine the light coin.&lt;br /&gt;
C1 &amp;lt; C3: [C2&amp;lt;C1&amp;lt;C3] C1 Impossible.&lt;br /&gt;
C1 &amp;gt; C3: [C2&amp;lt;C1&amp;gt;C3] C1 has a heavy coin. Apply&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt; Procedure 1&lt;/span&gt; to determine the heavy coin.&lt;br /&gt;
&lt;br /&gt;
[2] Weigh A vs. C&lt;br /&gt;
&lt;br /&gt;
A = C: [A=C&amp;lt;B] B has a heavy coin [9 cases]&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;Procedure 2:&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;Split the B coins into groups of three: B1, B2, B3&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;B1 = B2: B3 has a heavy coin. Apply&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt; procedure 1&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt; to determine which.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;B1 &amp;lt; B2: B2 has a heavy coin. Apply &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;procedure 1&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt; to determine which.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;B1 &amp;gt; B2: B1 has a heavy coin. Apply&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt; procedure 1&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt; to determine which.&lt;/span&gt;&lt;br /&gt;
A &amp;lt; C: [B&amp;gt;A&amp;lt;C] A has a light coin [9 cases] Apply &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt;Procedure 2&lt;/span&gt; to determine which.&lt;br /&gt;
A &amp;gt; C: [B&amp;gt;A&amp;gt;C] Impossible&lt;br /&gt;
&lt;br /&gt;
[3] Weigh A vs. C&lt;br /&gt;
&lt;br /&gt;
A = C: [A=C&amp;gt;B] B has a heavy coin [9 cases] Apply &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #134f5c;&quot;&gt;Procedure 2&lt;/span&gt; to determine which.&lt;br /&gt;
A &amp;lt; C: [B&amp;lt;A&amp;lt;C] Impossible&lt;br /&gt;
A &amp;gt; C: [B&amp;lt;A&amp;gt;C] A has a heavy coin [9 cases] Apply &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #134f5c;&quot;&gt;Procedure 2&lt;/span&gt; to determine which.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/7089786468589774116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solution-to-weights-puzzle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/7089786468589774116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/7089786468589774116'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/solution-to-weights-puzzle.html' title='Solution to Weights Puzzle'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8638087380797358882.post-2909230749359178720</id><published>2011-07-30T22:16:00.000-07:00</published><updated>2011-07-31T21:14:08.258-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Puzzle Weights interview"/><title type='text'>Weighing in a Harder Way</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: white; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;You&#39;ve got 27 coin, each of them is 10 g, except for 1. The 1 different coin is 9 g or 11 g (heavier, or lighter by 1 g). You should use balance scale that compares what&#39;s in the two pans. You can get the answer by just comparing groups of coins.&lt;br /&gt;
What is the minimum number weighings that can always guarantee to determine the different coin.&lt;br /&gt;
&lt;br /&gt;
Answer:&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;http://good-interview-puzzles.blogspot.com/2011/07/solution-to-weights-puzzle.html&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://good-interview-puzzles.blogspot.com/feeds/2909230749359178720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/weighing-in-harder-way.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/2909230749359178720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8638087380797358882/posts/default/2909230749359178720'/><link rel='alternate' type='text/html' href='http://good-interview-puzzles.blogspot.com/2011/07/weighing-in-harder-way.html' title='Weighing in a Harder Way'/><author><name>ravithej007</name><uri>http://www.blogger.com/profile/01806086084189643684</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>