Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. logical interview question...

logical interview question...

Scheduled Pinned Locked Moved The Lounge
questioncomregexcareer
30 Posts 16 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Pete Madden

    a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

    R Offline
    R Offline
    RC_Sebastien_C
    wrote on last edited by
    #2

    puts milk in the first coffee before sending it back, the new one comes back black ?

    1 Reply Last reply
    0
    • P Pete Madden

      a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #3

      he kept the bad one just in case .


      Maximilien Lincourt Your Head A Splode - Strong Bad

      1 Reply Last reply
      0
      • P Pete Madden

        a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

        M Offline
        M Offline
        Matias Szulman
        wrote on last edited by
        #4

        If he already put sugar in the old cup, he just has to taste the new one

        1 Reply Last reply
        0
        • P Pete Madden

          a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

          B Offline
          B Offline
          brianwelsch
          wrote on last edited by
          #5

          follow her to the coffe machine if it's that big an issue.... ;) BW


          All the chickens get it.
          And them singing canaries get it.
          Even strawberries get it.

          1 Reply Last reply
          0
          • P Pete Madden

            a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

            D Offline
            D Offline
            DavidNohejl
            wrote on last edited by
            #6

            nobody says that she brought *that* cup back with her? So he has two cups now... ? David "Stay Kul And Happy" I.A.

            1 Reply Last reply
            0
            • P Pete Madden

              a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

              D Offline
              D Offline
              Daniel Turini
              wrote on last edited by
              #7

              Break the damn cup of coffee, destroy everything on the coffee shop, shoot the waitress 3 times in the head and enjoy the loot! Now, would you hire me? I see dead pixels Yes, even I am blogging now!

              P 1 Reply Last reply
              0
              • P Pete Madden

                a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

                E Offline
                E Offline
                El Corazon
                wrote on last edited by
                #8

                Pete Madden wrote: how does the man know if its not the same cup of coffee? A) It is a matter of exchanged trust. If the waitress is one you know and trust, you need provide not test of that trust. She knows she will get a better tip from you by doing what is right, you know you will get the right cup for the same reason. Although I cannot imagine a waitress whom I trust giving me a cup with a match in it... so on to B. B) Where trust has not been earned through shared experience, it is often tested. a bit of cream in the coffee makes the floating objects show up better to point out, and provides a test of trust. As someone else said, if it comes back black, it's a fresh cup. _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                C 1 Reply Last reply
                0
                • P Pete Madden

                  a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

                  S Offline
                  S Offline
                  Shog9 0
                  wrote on last edited by
                  #9

                  ...to drink while he waited for his second cup of match-coffee. Mmmm, matches...

                  ----------------------------------------
                  the ocean is full because everyone's crying

                  1 Reply Last reply
                  0
                  • D Daniel Turini

                    Break the damn cup of coffee, destroy everything on the coffee shop, shoot the waitress 3 times in the head and enjoy the loot! Now, would you hire me? I see dead pixels Yes, even I am blogging now!

                    P Offline
                    P Offline
                    Pete Madden
                    wrote on last edited by
                    #10

                    yes I would ... if I plan to leave the company soon :) http://www.boreddude.com

                    D 1 Reply Last reply
                    0
                    • P Pete Madden

                      yes I would ... if I plan to leave the company soon :) http://www.boreddude.com

                      D Offline
                      D Offline
                      Daniel Turini
                      wrote on last edited by
                      #11

                      Pete Madden wrote: yes I would ... if I plan to leave the company soon But isn't my way of solving the problem "thinking outside the box"? I see dead pixels Yes, even I am blogging now!

                      E 1 Reply Last reply
                      0
                      • D Daniel Turini

                        Pete Madden wrote: yes I would ... if I plan to leave the company soon But isn't my way of solving the problem "thinking outside the box"? I see dead pixels Yes, even I am blogging now!

                        E Offline
                        E Offline
                        El Corazon
                        wrote on last edited by
                        #12

                        Daniel Turini wrote: But isn't my way of solving the problem "thinking outside the box"? I would classify it as "destroying the box" rather than thinking inside or outside. Thinking outside the box would be to pull out your notepad and start taking notes on service to turn into a magazine (ficticious or otherwise) in order to have all of the staff trying to make up for that cup with the match so that you get better than average service from there on. _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                        1 Reply Last reply
                        0
                        • P Pete Madden

                          a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

                          C Offline
                          C Offline
                          code frog 0
                          wrote on last edited by
                          #13

                          There is not enough information to answer it. Coffee has match in it: - We don't know when he asked for another cup immediately or after drinking the first one. - The man may have removed the match. - He may not have even been bothered by the match and just wanted more coffee. The waitress brings another cup: - Did she leave the old one or take it with her? - Another cup in many restaurants means a refill not a new cup. How does the man know: - He doesn't. To many unknowns. We don't even know if he's drinking the coffee. He might now have 2 cups for no reason.

                          I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.

                          E 1 Reply Last reply
                          0
                          • P Pete Madden

                            a waitress brings a man a cup of coffee with a match in it ... the man sees that and asks for another cup ... the waitress goes back and brings another cup of coffee ... how does the man know if its not the same cup of coffee? http://www.boreddude.com

                            C Offline
                            C Offline
                            code frog 0
                            wrote on last edited by
                            #14

                            How stupid do *I* have to be to screw up this question. It's 9 balls not 8. ARGGHHH! With 8 balls it's trivial it falls right out. There's 9 :doh: You have a classic scale. You put known weights on one side to calculate the unknown weight of the other. = You have 9 balls all the same size. No visible characteristics make one appear larger or smaller but one of them weighs more. = What is the least number of measurements used to isolate the heaviest ball. {Sorry it's been 4 years since I last thought about this. Now I remember the question.} This can be done I got it in my interview at my last job before I went on my own. It was an 8 hour interview filled with crud like this. (I later learned that most people *do not* get this and the fact I *did* got me hired. LAME!!!) - Rex

                            I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.

                            S P 2 Replies Last reply
                            0
                            • E El Corazon

                              Pete Madden wrote: how does the man know if its not the same cup of coffee? A) It is a matter of exchanged trust. If the waitress is one you know and trust, you need provide not test of that trust. She knows she will get a better tip from you by doing what is right, you know you will get the right cup for the same reason. Although I cannot imagine a waitress whom I trust giving me a cup with a match in it... so on to B. B) Where trust has not been earned through shared experience, it is often tested. a bit of cream in the coffee makes the floating objects show up better to point out, and provides a test of trust. As someone else said, if it comes back black, it's a fresh cup. _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                              C Offline
                              C Offline
                              Chris Maunder
                              wrote on last edited by
                              #15

                              but what if the coffee was a latte? cheers, Chris Maunder

                              E L 2 Replies Last reply
                              0
                              • C Chris Maunder

                                but what if the coffee was a latte? cheers, Chris Maunder

                                E Offline
                                E Offline
                                El Corazon
                                wrote on last edited by
                                #16

                                Chris Maunder wrote: but what if the coffee was a latte? Never buy a latte from someone you don't trust. :-D _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                C 1 Reply Last reply
                                0
                                • C code frog 0

                                  There is not enough information to answer it. Coffee has match in it: - We don't know when he asked for another cup immediately or after drinking the first one. - The man may have removed the match. - He may not have even been bothered by the match and just wanted more coffee. The waitress brings another cup: - Did she leave the old one or take it with her? - Another cup in many restaurants means a refill not a new cup. How does the man know: - He doesn't. To many unknowns. We don't even know if he's drinking the coffee. He might now have 2 cups for no reason.

                                  I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.

                                  E Offline
                                  E Offline
                                  El Corazon
                                  wrote on last edited by
                                  #17

                                  code-frog wrote: We don't even know if he's drinking the coffee. Blasphemy!!! ;P _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                  1 Reply Last reply
                                  0
                                  • C code frog 0

                                    How stupid do *I* have to be to screw up this question. It's 9 balls not 8. ARGGHHH! With 8 balls it's trivial it falls right out. There's 9 :doh: You have a classic scale. You put known weights on one side to calculate the unknown weight of the other. = You have 9 balls all the same size. No visible characteristics make one appear larger or smaller but one of them weighs more. = What is the least number of measurements used to isolate the heaviest ball. {Sorry it's been 4 years since I last thought about this. Now I remember the question.} This can be done I got it in my interview at my last job before I went on my own. It was an 8 hour interview filled with crud like this. (I later learned that most people *do not* get this and the fact I *did* got me hired. LAME!!!) - Rex

                                    I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.

                                    S Offline
                                    S Offline
                                    Sean Cundiff
                                    wrote on last edited by
                                    #18

                                    Well, since you've told me that one ball is heavier than the others the difficulty of the problem is reduced by an order of magnitude. This becomes a simple binary search. The heavier ball can be found in a minimum maximum of log(8)=3 moves. (base 2 of course). 1 - Place 4 balls on each plate. The lower side contains the heavier ball. Toss the 4 balls from the light side. 2 - Place 2 balls on each plate. Once again toss the light side. 3 - Place 1 ball on each plate. The heavier side indicates the desired ball. Now, if you really want to make the problem difficult, consider 8 balls that are identical in every way except that one of the balls has a different weight. What is the least number of measurements to locate the different ball and is it heavier or lighter than the other balls. -Sean ---- Shag a Lizard

                                    R C 2 Replies Last reply
                                    0
                                    • S Sean Cundiff

                                      Well, since you've told me that one ball is heavier than the others the difficulty of the problem is reduced by an order of magnitude. This becomes a simple binary search. The heavier ball can be found in a minimum maximum of log(8)=3 moves. (base 2 of course). 1 - Place 4 balls on each plate. The lower side contains the heavier ball. Toss the 4 balls from the light side. 2 - Place 2 balls on each plate. Once again toss the light side. 3 - Place 1 ball on each plate. The heavier side indicates the desired ball. Now, if you really want to make the problem difficult, consider 8 balls that are identical in every way except that one of the balls has a different weight. What is the least number of measurements to locate the different ball and is it heavier or lighter than the other balls. -Sean ---- Shag a Lizard

                                      R Offline
                                      R Offline
                                      Rui A Rebelo
                                      wrote on last edited by
                                      #19

                                      Can solve in 2 moves (the first problem). 1 - Place 3 balls in each side. If both sides have the same weight: 2- Test the 2 remaining balls. Else 2- Test 2 of the 3 balls in the heaviest side. If they have same weight the heaviest is the one left out, else ... Rui A. Rebelo De perto, ninguém é normal. (At a close look, no one is normal) C. Veloso

                                      S 1 Reply Last reply
                                      0
                                      • R Rui A Rebelo

                                        Can solve in 2 moves (the first problem). 1 - Place 3 balls in each side. If both sides have the same weight: 2- Test the 2 remaining balls. Else 2- Test 2 of the 3 balls in the heaviest side. If they have same weight the heaviest is the one left out, else ... Rui A. Rebelo De perto, ninguém é normal. (At a close look, no one is normal) C. Veloso

                                        S Offline
                                        S Offline
                                        Sean Cundiff
                                        wrote on last edited by
                                        #20

                                        oops, what I meant to say was it would take a maximum of 3 moves. Yeah, that's it. :doh: -Sean ---- Shag a Lizard

                                        C 1 Reply Last reply
                                        0
                                        • C code frog 0

                                          How stupid do *I* have to be to screw up this question. It's 9 balls not 8. ARGGHHH! With 8 balls it's trivial it falls right out. There's 9 :doh: You have a classic scale. You put known weights on one side to calculate the unknown weight of the other. = You have 9 balls all the same size. No visible characteristics make one appear larger or smaller but one of them weighs more. = What is the least number of measurements used to isolate the heaviest ball. {Sorry it's been 4 years since I last thought about this. Now I remember the question.} This can be done I got it in my interview at my last job before I went on my own. It was an 8 hour interview filled with crud like this. (I later learned that most people *do not* get this and the fact I *did* got me hired. LAME!!!) - Rex

                                          I know you can't become if you only say what you would have done and you'll miss a million miles of fun." - Len Work hard, play hard. Don't forget who you are and don't forget where you're from. Do all these things well and you won't have to wonder where you are going.

                                          P Offline
                                          P Offline
                                          peterchen
                                          wrote on last edited by
                                          #21

                                          2 steps


                                          Pandoras Gift #44: Hope. The one that keeps you on suffering.
                                          aber.. "Wie gesagt, der Scheiss is' Therapie"
                                          boost your code || Fold With Us! || sighist | doxygen

                                          C 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups