• golddog (unregistered)

    --Put water into both jugs, stopping when they're about 3/4 full.

    --Add malted barley which you've prepared into wort, and yeast.

    --Cap both container with a valve to let the CO2 off and wait a few days until the fermentation is done.

    --Bottle contents with a little finishing sugar, cap, and wait a little more.

    --Enjoy!

  • Dennis (unregistered) in reply to Anon
    Anon:
    Dennis:
    it's wrong because the UNWRITTEN assumption is that the 4 gallons has to end up in the 5-gallon container.

    It's not an UNWRITTEN assumption. It's the only solution to the problem as stated. If you redefine the problem by adding some external, like your fish tank, then you are solving a different problem. I guess you could call it an assumption since the 5 gallon container is the only one large enough to hold 4 gallons, but if you're not capable of figuring that out yourself...

    Bzzzzzt! Wrong! But thanks for playing. The exact question is "How would you get four gallons of water?". NOT "How would you end up with 4 gallons of water in one of the containers?". In ENGLISH (the language I'm speaking, and the language the problem is written in), "get 4 gallons" does not MEAN or even IMPLY that it has to end up in the 5-gallon jug. You may ASSUME that's what it means, but that's just an assumption. And based on the puerile cheapshot at the end of your post (which I suppose you think strengthens your argument), I'd say the first 3 letters certainly apply. And if you still disagree, please post the EXACT WORDS that indicate SPECIFICALLY that the water should end up in one of the jugs, WITHOUT requiring an assumption. I'm not gonna hold my breath...

  • Matt (unregistered) in reply to Anon
    Anon:
    Anon:
    Jeff Dege:
    Actually, I was more interested in the "how would you weight a 747" question, from the click-thru.

    I'd weigh it the same way I weight my dog. He's a small dog, but he won't sit still on the scale, so I have to hold him.

    So, first I stand on the scale and weigh myself. Then I pick up the 747 and step on the scale again.

    Then I subtract.

    A friend of mine was asked this in an interview for a business-consulting (non-IT role). The interviewer obvisouly didn't read his resume (which included pilotting 747s). So when he was asked about it and he quoted the exact height (both unladen and full of fuel), it left the interviewer dumbstruck.

    I was also dumbstruck. I didn't know that the height of a 747 changed depending on whether or not it was full of fuel. On the other hand, how much does it weigh?

    I would imagine the weight of the fuel would cause the undercarriage suspension to compress a little so the height would also change ... I'd be rather worried if it didn't :o)

  • hellosalute (unregistered) in reply to DaveK
    DaveK:
    Josephus:
    Name:
    For those who wonder about the bottles:
    3 5 -- #1 and #2
    ---------------
    0 5 -- fill #2
    3 2 -- put 3 in #1
    0 2 -- empty #1
    2 0 -- empty #2 in #1
    2 5 -- fill #2
    3 4 -- fill #1 with #2

    wow, not hired. Inability to explain simple things in a comprehensible manner.

    wow, not hired. Inability to infer the meaning of a trivially obvious domain-specific notation.

    wow, not hired. Inability to have enough ass in his pants.

  • gilhad (unregistered)

    I did not know the water problem before, but I solved it in head on the spot. But it did not make me happy to came with so trivial solution, so I also elaborated couple of others, some of which was also in comments ... it all depends on the REASON to solve such restricted problem in unusual ways ... and on your creativity :)

    About manipulating water without planet or celestial body - it is also not problem, if you can accelerate/decelerate/rotate your space vehicle :)

    And the car problem have also nice ultimate solution to make happy all (provided you cannot mobile for help etc.) - let your friend drive your car, the dying person will came into luggage hold (well it is dying, so the transport is more important than comfort). You sit on the other seat in car, which left the only logical and possigle place for the hottie - to sit on your lap. Drive to hospital first, then to friends target, then you can take the hottie home alone :) Everybody get ride, everybody satisfied :)

    (Well actually i had seen many project programed in this way - to carry 4 people in 2 seat car)

  • (cs)

    When I was a little kid, that was on a test the school gave me -- given 5 and 3 quart jars, obtain exactly two quarts of water. I had walked them through how, given a stick of a fixed length, and the noon sun, you could make markings at reasonable distances on one of the jars, and finally the tester gave up and told me about the idea of filling the 5 quart jar, filling the 3 quart jar from it, and having 2 quarts left.

    I stared blankly for some period of time, then announced "You can get any number from one through eight."

    I still don't know whether I got credit, but I'd guess I didn't.

  • daddy (unregistered) in reply to Dennis

    Your answer is correct. You can have a beef against people who'd say your answer is incorrect but there's nothing wrong with the problem itself. Maybe you've just interacted with the wrong kind of problem-askers.

    A good asker might go with "yes, that's correct. Now suppose the fishtank is too heavy to carry, and it's far from the spout. Could you find a way to put the 4 gallons in without taking as many trips back and forth?" He'd do that if he wants to give you another interesting problem (assuming you'r doing them for fun), or because (for some reason) he realizes he forgot to make the assumption explicit, so he fixes that now.

  • Boss (unregistered) in reply to DaveK
    DaveK:
    Josephus:
    Name:
    For those who wonder about the bottles:
    3 5 -- #1 and #2
    ---------------
    0 5 -- fill #2
    3 2 -- put 3 in #1
    0 2 -- empty #1
    2 0 -- empty #2 in #1
    2 5 -- fill #2
    3 4 -- fill #1 with #2

    wow, not hired. Inability to explain simple things in a comprehensible manner.

    wow, not hired. Inability to infer the meaning of a trivially obvious domain-specific notation.

    wow, fired. Inability to understand the difference between a correct answer and a good answer.

    If you can't communicate with your customer then you are only 10% as useful as someone who can. Doesn't matter how well you can use dev-speak.

  • Mike (unregistered) in reply to P.M.Lawrence
    P.M.Lawrence:
    agrif:
    Anon:
    AndersI:
    I would put the five gallon bottle on the scale and fill water into it until it is 4 kg heavier.

    Great answer. Put it on the scale that the problem explicitly stated that you didn't have.

    Even better, 4 kg of water is 4 liters, not 4 gallons. You'd want 32 pounds (a pint's a pound the world around, unless you lived in civilized nations where a pound is for dogs)

    That US mnemonic ("a pint's a pound the world around") is factually incorrect, because in most parts of the world where those units are used at all "a pint of water weighs a pound and a quarter".

    That would leave a gallon of water weighing 10 pounds, which is does not. A gallon of water weighs slightly over 8 pounds, part of which will be the weight of the container I used to hold the water while I weighed it. I was unable to set a tare weight due to the fact that I used a seaped gallon of purified water, and I didn't have another gallon jug handy. Also, this calculation was made approximately 745 feet above sea level, very near midnight local time, with a waning gibbous moon.

  • Duh! (unregistered) in reply to Mike
    Mike:
    P.M.Lawrence:
    That US mnemonic ("a pint's a pound the world around") is factually incorrect, because in most parts of the world where those units are used at all "a pint of water weighs a pound and a quarter".

    That would leave a gallon of water weighing 10 pounds, which is does not.

    Allowing for a bit of variance due to thermal expansion and impurities, it does. Practically everywhere in the world except the USA.

  • Random832 (unregistered) in reply to Ozz
    Ozz:
    You left the service manual in your other pants. Now what do you do?

    I go to Boeing, and offer to trade a barometer for the service manual.

  • puzzled (unregistered)

    I find these puzzles interesting, but as interview tools I think they're horrible, not because they're ridiculous or easy to look up, but because they ARE effectively trick questions if you don't already know the solution, which moreover depends on how well you already know the subject matter of the puzzle:

    Water bottle puzzle:

    • I would start with something like "According to the rules, there is no way to fill or empty a bottle only partway and know how much is in it by looking at the bottle, therefore the complete list of possible actions is: (1) fill bottle 1 with 3 gallons, (2) fill bottle 2 with 5 gallons, (3) attempt to pour all of the water in bottle 1 into bottle 2, (4) attempt to pour all of the water in bottle 2 into bottle 1, (5) empty out bottle 1 on the ground, (6) empty out bottle 2 on the ground. I have to find some sequence of a subset of those 6 actions that ends up with 4 gallons of water being in either bottle." I wouldn't word it exactly like that, of course, but that would be my premise.
    • Given that set of rules, I wouldn't have to go far to prove that it's impossible to solve the problem with that set of 6 actions I created. So I must be missing something. Something about the properties of water in bottles, an unstated rule. Would I be able to guess what it is under the pressure of an interview? I've never had to, but my guess is, certainly not.
    • The missing rule in this case is: "When pouring water from one bottle to the other, it is possible to judge when the second bottle is full with sufficient speed and accuracy that no water is spilled and all water that can't fit in the second bottle at that instant remains in the first bottle."
    • I would argue that failing to state that rule has turned this into a trick question, and not a logic test at all, because the focus is entirely on how well you can guess this one unwritten rule instead of how well you can solve a fully-stated logic problem. I would have solved the problem easily if told that missing rule. But I have little experience at pouring water between bottles. My assumption that it is impossible to fill the second bottle from the first without losing track of how much water couldn't fit in the second bottle is so basic that it never would have occurred to me consciously that I am assuming it or that I am allowed to expect a hypothetical person to have a much higher level of skill at pouring water between bottles than I've ever observed (I would sooner have questioned my assumption that water is the only liquid I should be thinking about putting in the bottle). Getting past that is as much about cultural knowledge or personal background as anything else, which isn't what you want to test in an interview.

    "3 girls, 2 condoms and 1 guy" puzzle:

    • It would never have occurred to me that wearing a condom inside-out could possibly be considered safe, or that wearing two condoms at once could possibly be considered safe. So I would have had a laughably incomplete list of possible actions, and a whole lot of unrelated thoughts about sex to enumerate in hopes of finding the missing ones. The interviewer would undoubtedly run out of patience while I'm still considering that there might be something about (say) oral sex that I'm not thinking creatively enough about. I would not have thought to ask the question "So, what sorts of things can I do with a condom that are safe?", not least because of the embarrassment factor.

    Box with 3 switches and 3 light bulbs inside:

    • It would never have occurred to me in the context of this question to think that light bulbs get warm when turned on, or that touching the light bulbs while the box is open is even a possibility. The question-asker is expecting me to add a totally new axis to the problem that wasn't even hinted at by the logical setup of it, exactly like expecting me to guess that I can deduce what order the bulbs have been turned on in by sense of smell (maybe I can, I don't know, I don't have much experience with smelling lightbulbs either and if that really were the answer it would be equally crazy to expect it to come to people's minds).
    • All that shows (if anything) is that I'm bad at thinking outside the box about lightbulbs. I don't know about you, but I would rather know if a candidate is good at thinking outside of the box about something related to their job. If you were to ask me to think outside the box in order to solve some programming task, for example, I would do much better at it, even if the particular task is totally unfamiliar to me... Why not either add that extra bit of relevance or state the rules more fully to make it closer to a proper logic question, instead of asking trick questions like these ones?
  • lolwut (unregistered)

    WHARTON, lol!

  • Kef Schecter (unregistered) in reply to Iago
    Iago:
    Seriously, if you think it's difficult to add and subtract tiny integers in your head, please stop programming immediately.

    If you think programmers need to add and subtract tiny integers in their heads to be able to program well, please stop interviewing them immediately.

    I've been a programmer -- largely, but not only, as a hobbyist -- for over ten years and I'm rarely ever required to do it. And no, I'm not particularly good at it. I don't need to be good at it. Can you name even one programming problem where that skill is required or even particularly useful? The computer is perfectly capable of adding and subtracting numbers so I don't have to.

    It's not just me, though. I know that some of the greatest mathematical minds in history were not particularly good at adding or subtracting small numbers without using a calculator (or at least pencil and paper). There is surprisingly little correlation between mental calculation and general mathematical or computational skill. Don't believe me? Try to get Rain Man to solve the water bottle puzzle.

    • Kef
  • CBM (unregistered) in reply to AndersI
    I would put the five gallon bottle on the scale and fill water into it until it is 4 kg heavier.
    4Kg? Trying that in a NASA interview might be seen as poor taste.
  • Lang Sharpe (unregistered)
    Our compensation reflects the importance of this position

    Your being paid to be a typist. You'll be paid the same as a typist?

  • kfh (unregistered) in reply to Da' Man

    You jest, but....

    In Basic, on a Prime machine (IIRC) circa 1981, this was actually possible. If you made a typo like "LET 5=4;" and then printed the value of the number 5, it would print 4.

    Oh, the pain....

  • Dr. Evil (unregistered) in reply to PITA
    PITA:
    There are two water bottles. One can hold exactly three gallons and one can hold exactly five gallons. There is no scale, no dividing lines, and the bottles are odd shaped, meaning no visual measurement is possible. You can, however, empty and fill the bottles with water as many times as you want. How would you get four gallons of water?
    Out of the tap?
    WIN!!
  • (cs) in reply to Hi OJ
    Hi OJ:
    Perhaps they meant Au pair programming????

    Captcha: gravis (what a great game pad!)

    Who looks for a job on Craigslist?! I would expect an ad for Ménage à trois Programming, maybe.

  • (cs) in reply to Anon
    Anon:
    I think your interview questions are a little weak. The "Why do you like C# more than VB" can demonstrate someone's familiarity level with both languages, but that's about it.
    That is probably exactly why it was asked.

    Demonstrating basic familiarity with the things you wrote on the resume is often the first goal of an interviewer. It doesn't take long and allows you to quickly eliminate a surprising number of people.

  • anonymous (unregistered) in reply to Anon
    Anon:
    I was also dumbstruck. I didn't know that the height of a 747 changed depending on whether or not it was full of fuel.
    It has air-filled tires, you know.
  • Carra (unregistered)

    Heck, I came up with two different methods which require a basin.

    -2x5 in the basin -2x3 out of the basin -Done!

  • Nessuno (unregistered) in reply to Abdiel
    Abdiel:
    RogerInHawaii:
    Zapp Brannigan:
    alegr:
    AndersI:
    I would put the five gallon bottle on the scale and fill water into it until it is 4 kg heavier.
    Who would have thought one gallon weights one kilogram... Oh, wait...
    No one specified the planet. Are you assuming it's Earth?

    Ummm, kilogram is a measure of mass, not weight. Right? So it wouldn't matter what planet you're on, or even that you're on a planet.

    You might find it difficult to pour anything anywhere if you are not located on a planet, or at least another suitable celestial body providing a reasonable gravitational pull.

    Well, you can always just rotate. Inertia takes care of the rest.

  • (cs)

    I never understood why the water 'puzzle' is defined as a 'logic' problem, it's just to do the ONLY move that doesn't end in an initial state and it's completely linear. It's like solving a 3-move chess/go problem.

    Correct me if I'm wrong: 5* 0; 2 3*; 2 0; 0 2; 5* 2; 4 3*; done

    The 'pair programmer' doesn't look like a bad part-time position, really. Has TDWTF degraded into laughing at people who actually might know what they're doing but who don't necessarily have the exact words to describe them? And before you complain about the 'excellent English skills' part, that's just what's in every (non-British, since that's discrimination over there) application anyway.

  • Maurice (unregistered) in reply to Remy Porter

    No its not a good question the containers are described as bottles try putting a normal size coke bottle inside a 1.5L coke Bottle some time.

    And if they where open topped cans it wouldnt realy be 4 Gallons as the 3 gal container would displace slightly more than 3 gals of water the container it's self would displace water.

  • lisa (unregistered)

    at least the ad for pair programmer was honest! I've seen one too many cases where one person severely dominates while "pairing"...it gives the whole process a bad name.

  • Mark J. (unregistered) in reply to bottlefiller
    bottlefiller:
    Name:
    For those who wonder about the bottles:
    3 5 -- #1 and #2
    ---------------
    3 0 -- fill #1
    0 3 -- put 3 in #1
    3 3 -- fill #1
    1 5 -- empty #1 in #2
    1 0 -- empty #2
    0 1 -- empty #1 into #2
    3 1 -- fill #1 
    0 4 -- empty #1 into #2
    

    I especially like the part where two gallons magically disappear out of bottle #1!

    CAPTCHA: acsi - a crime scene investigator?

  • Ol' Bob (unregistered)

    The Ideal Pair Programmer - OMG! WTF?!? Please - do yourself a huge favor - go to the http://broadstreetanalytics.com/team.html page and have a look at their 'team'. Read carefully, but try not to annoy those near you with subsequent chuckles, chortles, guffaws, and/or giggles. Highlights - the CEO lists his high school graduation; his big-time experience is in the MBS market - yes, that's "Mortgage Backed Securities" - where he was in charge of developing their mortgage credit model - OMG!!! The COO has apparently dropped out of the Ph.D. program at Wharton, but he's still shown on their website at http://opimweb.wharton.upenn.edu/people/faculty.cfm?id=74. Run screaming!; the "Senior Designer" has multiple degrees in Architecture - not Software Architecture, but the kind involved in putting up buildings - he's in charge of their wonderful website, so check this page http://broadstreetanalytics.com/technology.html and note that the white text bleeds off into the white background on the right - but hey, he's got multiple degrees so it must be great; and their Software Developer (Pair Programmer???) has an MS in Comp Sci to top off his BS in International Studies - WTF? ROFLMAO!

  • (cs)

    Although I've watched all the Die Hard movies, I do not remember the water riddle; however, because no requirement was given to put water in both bottles I'd just put four gallons into the five gallon bottle and be done with it. As an added bonus, just take a typical five gallon office bottle and pour it in, no measurement required.

  • (cs) in reply to drfreak

    Oops, I created my own WTF. Ok, pour five gallons from the office bottle into the four gallon container and let the rest spill out. Done!

  • Prism (unregistered) in reply to James
    James:
    I'd go with the alternate solution:

    #1 is the 5 gallon jug #2 is the 3 gallon jug

    Fill #1, empty it into #2, so 2 gallons left in #1. Grab the sharpie off your desk, mark the water level. Dump #2 out. Pour the 2 gallons into #2. Refill #1 to the mark, then dump the 2 gallons from #2 back in.

    Fill the 5g, fill 3g from 5g, point to the 5g and say "I have 2 gal, let me know when you need 2 more"

    When the interviewer balks, tell him you are demonstrating an asynchronous function, caching and reducing processor load by eliminating needless steps.

  • Prism (unregistered) in reply to zelator
    zelator:
    Best question ever:

    If a hen-and-a-half can lay an egg-and-a-half in a day-and-a-half, how many one-and-a-half egg omelettes can you make in a week-and-a-half?

    None. I have no eggs or hens.

    Two cars are driving towards each other at 60 mph, on the front bumper of one car is a fly who will fly back and forth between the cars until they crash together, the fly can fly 120 mph at all times, given the cars are two miles apart, how far will the fly fly before it meets its fate?


    Fast as you can, name 3 animals whose names start with a double letter -- ex. Ccat.


    How about a really hard one?

    Given a specified desktop area, with a set of randomly placed windows, give an algorithm that would pick the window most like a target window in terms of size, location, and proportion. Solution should correct for any results that would appear non-intuitive to a human should they exist.

    Bounds and limits: Windows max size is the desktop, and windows will always have some portion showing on the desktop.

  • Prism (unregistered) in reply to RogerInHawaii
    RogerInHawaii:
    Fill the 3 gallon container. Count the number of water molecules in it. Divide by 3 to get the number of water molecules in a gallon of water. Put that number of water molecules in the 5 gallon container.

    Isn't everyone in this forum a computer programmer, or at least familiar with computer programming? Don't we deal with digital computers? So why address this problem from an analog perspective, i.e. measuring the water instead of counting it?

    First of all, to get all technical on your 'spec' -- I believe that there is only ONE molecule of water in any cohesive glob of water. At least I heard that somewhere.

    Second, your spec also uses analog measure in the beginning, why not simply say "reach into the 5 gal container and extract the appropriate number of ATOMS that will be sufficient to produce 4 gallons of water at the given temperature and air pressure."?

    Your solution 'violates the analogy' IMO. It would be like saying "We can unit test by peeling the top off our CPU and Memory at the right moment and peer in with an electron microscope to see if the results are as expected"

    Sure, all this is possible, if you happen to be GOD.

    I will give my answer again that I have already posted, because so far, I think its the best:

    Fill 5g, dump 3g into 3g, point at the 2g remaining in the 5g and say to the interviewer "I now have 2g, let me know when you need the other 2g"

    When he balks, tell him you are demonstrating an asynchronous function, caching, and also reducing processor workload compared to the typical solution.

  • Mike (unregistered) in reply to b

    Old post I realize but perhaps the senior developer is a code ninja but has CTS or something. They don't want to lose their rockstar so they are willing to pay $20/hr extra for a secretary.

  • Isikyus (unregistered) in reply to AndersI

    Congratulations! You now have four metric gallons of water.

  • Link to the company of paired programming (unregistered)

    http://www.ufora.com/company/team/ ROFL

Leave a comment on “All Over the Map, Odd Shaped Container, and The Ideal Pair Programmer”

Log In or post as a guest

Replying to comment #:

« Return to Article