Help - Search - Members - Calendar
Full Version: Which Machine Gives What...
Hamara Forums > General > Games N' Puzzles
vivekpm
This was asked to me in an interview... Fairly simple one...


You have 3 vending machines: one is for Pepsi, another for Coke and third one is a mixed (gives both pepsi and coke in some order which is immaterial).

The labels (reading "Pepsi", "Coke" and "Mixed") on these three machines are incorrect or interchanged... That is, no machine has correct label on it

You have one coin which you can use obviously only with one machine and using this solitary coin you need to identify correctly which machine gives what...

How will you do it...

Cheers,
rumbass
So simple, instead of wasting time, switch to another shop and have
a sprite.Sprite bujhaye only pyass baki sab bakwas.

rum
sauptik
Too Good solution rumbass
man123
I have the answer ,

Condition: "All labels are incorrect on all machines"

the approach is like this :


First put coin in the machine , which has label of "Mixed". If you get Pepsi, then it means the machine which has label of "Pepsi" is having mixed and machine which has label of "Coke" contains mixed drink.

If you get Coke in "Mixed" label machine, then it means the machine which has label of "Coke" does have mixed and the machine which has label of "Pepsi" contains mixed drink.


smile1.gif
- Man
Pradeep
If you get coke, it can be mixed too naa.. meaning if u put another coin in the same machine, u might get pepsi too.

vivek bhai.. kaunse company mein kaam karte ho.. abhi bol daalo... mera application wahan se hata dunga wink2.gif
vivekpm
QUOTE(man123 @ Oct 29 2004, 05:17 PM)
I have the answer ,

Condition:  "All labels are incorrect on all machines"

the approach is like this :


First put coin in the machine , which has label of "Mixed". If you get Pepsi, then it means the machine which has label of "Pepsi" is having mixed and machine which has label of "Coke" contains mixed drink.

If you get Coke in "Mixed" label machine, then it means the machine which has label of "Coke" does have mixed and the machine which has label of "Pepsi" contains mixed drink.


smile1.gif
- Man
*



You condition that "All labels are incorrect on all machines" is valid. That is what I mentioned in problem statement too...

But I probably didn't get your solution... If you get "Pepsi" in mixed then why can't machine labeled "Pepsi" be "Coke"?? Why it has to be only "Mixed"???
vivekpm
QUOTE(Pradeep @ Oct 29 2004, 05:22 PM)
vivek bhai.. kaunse company mein kaam karte ho.. abhi bol daalo... mera application wahan se hata dunga wink2.gif
*



smile1.gif Kuch faayda nahin... Yeh log sirf interview main aise questions puchte hain kaam to har jagah ek sa hota hai sad1.gif

Cheers,
man123
QUOTE(vivekpm @ Oct 29 2004, 08:29 PM)
QUOTE(man123 @ Oct 29 2004, 05:17 PM)
I have the answer ,

Condition:  "All labels are incorrect on all machines"

the approach is like this :


First put coin in the machine , which has label of "Mixed". If you get Pepsi, then it means the machine which has label of "Pepsi" is having mixed and machine which has label of "Coke" contains mixed drink.

If you get Coke in "Mixed" label machine, then it means the machine which has label of "Coke" does have mixed and the machine which has label of "Pepsi" contains mixed drink.


smile1.gif
- Man
*



You condition that "All labels are incorrect on all machines" is valid. That is what I mentioned in problem statement too...

But I probably didn't get your solution... If you get "Pepsi" in mixed then why can't machine labeled "Pepsi" be "Coke"?? Why it has to be only "Mixed"???
*





ooopss ,
galti se michtake ho gaya angry2.gif
while typing the solution i goofed up, let me modify my stmt

First put coin in the machine , which has label of "Mixed". If you get Pepsi, then it means the machine which has label of "Pepsi" is having Coke and machine which has label of "Coke" contains mixed drink.

If you get Coke in "Mixed" label machine, then it means the machine which has label of "Coke" does have Pepsi and the machine which has label of "Pepsi" contains Mixed drink.


ab galti to insano se hi hoti hai na cry.gif

i hope, u'l understand the solution now smile1.gif

- Man

vivekpm
QUOTE(man123 @ Oct 29 2004, 09:32 PM)
ooopss ,
galti se michtake ho gaya  angry2.gif
while typing the solution i goofed up, let me modify my stmt 

First put coin in the machine , which has label of "Mixed". If you get Pepsi, then it means the machine which has label of "Pepsi" is having Coke and machine which has label of "Coke" contains mixed drink.

If you get Coke in "Mixed" label machine, then it means the machine which has label of "Coke" does have Pepsi and the machine which has label of "Pepsi" contains Mixed drink.


ab galti to insano se hi hoti hai na cry.gif

i hope, u'l understand the solution now  smile1.gif

- Man
*




I guess your solution is correct smile1.gif Congratulations... gift.gif gift.gif gift.gif gift.gif

However IMHO this is not a perfect way to put the statements... Here is what my answer was...

1. Put a coin in "Mixed", if you get "Pepsi" the machine is a "Pepsi" machine since only cases when you can get "Pepsi" from this machine are:
a. If it is a "Mixed" machine, which it cannot be, since the label on it is "Mixed" which is incorrect as per the problem statement...
b. It is a "Pepsi" machine...

2. Now the machine labeled "Coke" cannot be a "Coke" machine because the labels are incorrect and it cannot be a "Pepsi" machine because we have already recognised "Pepsi" machine above. So it is a "Mixed" machine.

3. The third machine is obviously a "Coke" machine...

Same holds true if u get "Coke instead of "Pepsi" in step 1.

Cheers,
anurag
QUOTE(vivekpm @ Oct 29 2004, 12:36 PM)

Same holds true if u get "Coke instead of "Pepsi" in step 1.

Cheers,




Vivek

Same does n't hold true if you get Coke in step 1. In fact, if it's coke that you get in Step 1 from the machine with "Mixed" label, then it's a Coke machine, then the one with Pepsi label is mixed and the third one is Pepsi.

If you meant the same reasoning applies then yes, that's true but the answer would be different nontheless.

Cheers. thumbs-up.gif
vivekpm
QUOTE(anurag @ Oct 30 2004, 05:32 AM)
QUOTE(vivekpm @ Oct 29 2004, 12:36 PM)

Same holds true if u get "Coke instead of "Pepsi" in step 1.

Cheers,




Vivek

Same does n't hold true if you get Coke in step 1. In fact, if it's coke that you get in Step 1 from the machine with "Mixed" label, then it's a Coke machine, then the one with Pepsi label is mixed and the third one is Pepsi.

If you meant the same reasoning applies then yes, that's true but the answer would be different nontheless.

Cheers. thumbs-up.gif
*




smile1.gif True... To put it perfectly, I meant same reasoning smile1.gif

Cheers
bawlachintu
Yaar tumra kostion rong dikhta hai

Label Mirinda ka hoga ohmy.gif

Pepsi ya coke mein to color mein kuchh bhi difference nahin hai
Quetion karne wale ka mobile number do blink.gif

sunglasses2.gif sunglasses2.gif

chin 2
Bawra Jay
Well known riddle... seems they been using coke , pepsi , sprite , etc... to ask this riddle in different ways...

Similiar version of this riddle, I had come across long time back was like this :-

3 Vending Machines painted BLACK. 3 LABELS : COKE, SPRITE, COKE+SPRITE. ALL machines are labelled incorrect. One can is for a quarter. How many quarters do you need to find the correct labels for each machine ??

Answer : Only 1 quarter
Explanation: First put one quarter into C+S machine
if that gives C, then S is C+S and C is S
if that gives S, then C is C+S and S is C
(it cannot give C+S because it is labeled C+S)
vivekpm
Yes a very well known riddle... Later I learnt that this was in fact a question from "How would you move Mount Fuji" a well known book which describes in detail about Microsoft interview patterns...

There I guess it is in form of closed baskets containing Apples and Oranges...

There is a more naughty version too wink2.gif

Cheers,
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.