AceTheInterview
Jobs in Pune | Work better in teams | Socialize with friends | Submit Q&A | Tell a friend
Search site for 

Top 100 Interview Questions & Answers in a convenient and easy to read book!

“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”

– Ravi, California

Read more comments...

Interview Questions And Answers RSS Feed

Answers »

  1. Submitted By: byte03 — October 6, 2006
    +28 votes
      + -

    If you select 4 Jelly beans you are guarenteed that you will have 2 that are the same color.

  2. Submitted By: silencer — October 6, 2006
    -10 votes
      + -

    uhm.. sorry but could you explain this please?

    thank you

  3. Submitted By: bigharywang — October 6, 2006
    +7 votes
      + -

    It is quite simple. If you only take 4 jelly beans, the possible combos that you can come up with are, in terms or a,b and c:

    a,b,c,a a,b,c,b a,b,c,c
    a,a,b,c a,a,b,b a,a,c,c
    b,b,a,c b,b,a,a b,b,c,c
    c,c,a,c c,c,a,a c,c,b,b
    a,a,a,b a,a,a,c a,a,a,a
    b,b,b,a b,b,b,c b,b,b,b
    c,c,c,a c,c,c,b c,c,c,c

  4. Submitted By: pt1000 — October 6, 2006
    +27 votes
      + -

    If you pick out three, the worst case is that they are all different colors. So you would have to pick out one more to be certain that you aren’t effected by that worst-case scenario.

  5. Submitted By: sheen — October 6, 2006
    +4 votes
      + -

    4. Just pigeon-hole principle.. hehe

  6. Submitted By: otter — October 6, 2006
    +10 votes
      + -

    This is just the pigeon hole principal. Most questions to the effect of “How many do I need to gaurantee…” can be answered with it.

    If you dont know the PHP, I’ll give a shot at teaching it….

    Think of the three types of jelly beans as pigeon holes (or cubbie or boxes or whatever.) You have one hole/box/cubbie for each type of jelly bean. Now, start filling them up. Put the first 1 in the first box, put the second in the second box and put the third in the third box, now, when you put the 4th in a box, there is gauranteed to already be one in there. You are gauranteed to have a colision.

  7. Submitted By: johny — October 6, 2006
    -51 votes
      + -

    If you select 2, even if they are of different colors, you will surely get one of these colors in third pick.

  8. Submitted By: deep — October 6, 2006
    +0 votes
      + -

    pick 4 , this is pigeon hole principle in the other direction

  9. Submitted By: bhavin — October 6, 2006
    +6 votes
      + -

    A Simple one.

    You have to grab 4 jelly beans. In worse case first 3 beans will be all of different colors i.e. 1 red, 1 blue and 1 green. And the forth one will be anyone of those colors and hence 2 beans of same colors.

  10. Submitted By: mister obvious — October 20, 2006
    -20 votes
      + -

    You guys are over thinking it. Question states you “picked two of a like color.” Hence, you only need to pick two.

  11. Submitted By: BobJoe — October 24, 2006
    -1 votes
      + -

    The better question is, how many would you have to pick to guarantee two _different_ colors.

  12. Submitted By: Anuranjan — November 3, 2006
    -6 votes
      + -

    Say,
    t = count of type of balls
    n = number of items to pick

    then solutiomn will be
    (t * (n-1)) +1

    this will stand if t >= 2

  13. Submitted By: imti — January 3, 2007
    -13 votes
      + -

    hmm. i dont agree with 4…
    We have to assume some number for the three types, say if it has equal number of balls of each color, say 10 red, 10 blue and 10 green. Then you need to pick at least 11 to gaurantee that you have 2 of same color.
    If we assume uneual number of balls, say 10 red, 11 blue and 12 green, Then we need (MAX + 1) - so at least 13 balls to pick to be 100% sure that you have 2 of same color.

  14. Submitted By: z_m — January 14, 2007
    +8 votes
      + -

    imti —
    when you have picked 2 beans out of the 10 of 1 type arent they of the same color?
    the quesn doesnt talk abt picking 2 beans of any specific color - just 2 beans of the same color are needed

  15. Submitted By: Imti — January 19, 2007
    +0 votes
      + -

    ohh sorry ,, i was wrong, ans is (no of colors +1),
    in general (no of types +1)

  16. Submitted By: Austin — March 7, 2007
    +4 votes
      + -

    It depends… you might have to pick 50 if you plan on eating 46 before checking the collor.

  17. Submitted By: saranya — March 21, 2007
    +0 votes
      + -

    u pick up the 4 jelly beans.so that 2 beans will be same color.

  18. Submitted By: yadav — May 15, 2007
    -6 votes
      + -

    i think we need to the number of beans of each colour to the total no of beans in the bucket to discuss about this…………………

  19. Submitted By: Sarah — September 20, 2007
    -8 votes
      + -

    Again everyone is over thinking - read the question.
    It says.. “How many do you have to grab to be sure you have 2 of the same?”
    Does not say “Same COLOR”.
    Answer - 2

  20. Submitted By: Ashwin Kambli — October 17, 2007
    -1 votes
      + -

    Total number of jelly beans in the bucket - 2.

  21. Submitted By: T — April 23, 2008
    +2 votes
      + -

    The answer is at minimum 4 because you may have a hundred beans of each color so you may end up grabbing the same colored beans over and over again.

  22. Submitted By: Edward Buatois — July 10, 2008
    -4 votes
      + -

    There’s insufficient information to solve the problem. It doesn’t say how many beans there are overall, how many of each color there are, how the beans are distributed through the jar, or even whether there are equal amounts of each color. Without that information, no specific number can be given, nor can a specific algorithm be formulated.

  23. Submitted By: bob — October 15, 2008
    -1 votes
      + -

    why not look into the jar, see the ones you want to grab. Close your eyes and grab them?

  24. Leave an Answer/Comment

    To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
    Click to hear an audio file of the anti-spam word

Our Sponsors
Our Sponsors
Contact Us | FAQ | Sitemap | Terms of Use | Privacy Policy | Tell a Friend

Copyright © 1999-2006 Jeeve Technologies LLC. All rights reserved.