• SmartArse (unregistered)

    No mention of where we're getting the water from in the puzzle?

    I'd go down to the nearest shop and ask whether they can fill me 4 gallons of water in the 5 gallon bottle

    (isn't 5 gallon rather a lot of water to be playing around with?? I thought it was 5 litres in DH3)

  • SmartArse (unregistered) in reply to SmartArse
    SmartArse:
    No mention of where we're getting the water from in the puzzle?

    I'd go down to the nearest shop and ask whether they can fill me 4 gallons of water in the 5 gallon bottle

    (isn't 5 gallon rather a lot of water to be playing around with?? I thought it was 5 litres in DH3)

    Alternatively, fill the 5 gallon jug. We then have 4 gallons of water in there, with 1 remainder.

    (How many months have 28 days? All of them.) type thing...

  • täter (unregistered)

    Let's hope the Senior Programmer is a benevolent dictator.

  • Anon (unregistered) in reply to PeriSoft
    PeriSoft:
    Anon:
    This^. The right answer absolutely depends on your objective. The "right" answer as the OP puts it suggests that your ultimate objective is to get in the girl's pants, which isn't the moral or ethical decision. The right answer would be to take the dying person to hospital yourself because a) Your friend was waiting for the bus anyway, if you hadn't come along, they'd still be wait, so no loss on their part and b) stop thinking with your dick.

    I'd take the dying person to the hospital myself - I can drive much faster than any of my friends.

    Exactly, that and nobody drives my fucking car!!!

  • Jimbo (unregistered) in reply to dkf
    dkf:
    Jeff Dege:
    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.

    But you can get a 747 to sit still. Especially if you've got a BA crew…

    Time to clean the coffee off the monitor again!!!

    Gold!!

  • Quirkafleeg (unregistered) in reply to Ozz
    Ozz:
    anon:
    I'd find the weight of the 747 by reading the service manual. That's the right answer, right?
    You left the service manual in your other pants. Now what do you do?
    Wonder why I put them there instead of in my other trousers.
  • Chico (unregistered) in reply to Ozz
    Ozz:
    anon:
    I'd find the weight of the 747 by reading the service manual. That's the right answer, right?
    You left the service manual in your other pants. Now what do you do?

    "Hahaha...I thought this cigar was in my other coat.....Wait a minnute, this is my other coat!!"

  • BentFranklin (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    BentFranklin:
    Then you'd have a little over 1 gallon. UNIT WEIGHT FAIL!

    Under. A gallon is ~4.6 litres.

    UNIT VOLUME FAIL!

    That's because a litre is less than a liter.

    Please use US metric units, thank you.

  • Raptor85 (unregistered) in reply to ceiswyn

    Good to know I'm not the only assembly programmer in here...

  • Blah (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...

    Not the way it's stated in the article. Given that they're quite explicit about what there isn't (no scale, no dividing line....) we can assume we have other things at our disposal (such as the fish tank). This is part of the reason why such puzzles are a bad idea (if the interviewer wants a specific answer), they need to be explicit about exactly what you can and can't do. OTOH, I think allowing people to be creative and make their own assumptions gives a good indication of the way they think, and can give more valuable feedback than simply requiring that an answer is correct (this is a major failing in the way we teach math at the moment too, BTW - google "Mathematicians Apology" for an interesting article).

    The result, though necessary is not necessarily as important as the process...

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

    And you would then have 4 litres of water. That's a little less than you need, I think?

  • Anonymous (unregistered) in reply to Ozz
    Ozz:
    anon:
    I'd find the weight of the 747 by reading the service manual. That's the right answer, right?
    You left the service manual in your other pants. Now what do you do?

    I'd go your mother's house and get them.

    I don't care if I didn't get the job, it'd be worth it just to use that line in an interview.

  • (cs) 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.
    So does your car's. It's called "suspension".
  • (cs) in reply to Bellinghman
    Bellinghman:
    Kiss me I'm Polish:
    - the bus stop problem (you drive a small 2-person car, and you see a bus stop where 3 people gathered: a friend of yours, a woman with whom you instantly fall in love, and a dying person who needs medical attention to survive. Oh and it's raining. What do you do? There is a *right* answer, and either you know it or you lose)
    This is a new one on me.
    Except of course that when you hit "Quote" on that post, you got to see the answer in plain text, before you snipped it away, immediately after the last word that you left in there. So not all that new to you...
  • Quirkafleeg (unregistered) in reply to BentFranklin
    BentFranklin:
    Then you'd have a little over 1 gallon. UNIT WEIGHT FAIL!
    No; you'd have a little over 7 pints.
  • (cs) in reply to Problem Solver
    Problem Solver:
    Oh you mean what does the 747 weigh? Have it take off. Now it is in flight, and weightless. Answer = zero.
    You are now officially the worst pilot in the world of all time ever, since pretty much the most fundamental skill that any pilot needs is knowing the difference between 'flight' and 'free fall'. Remind me never to book a flight on your airline.
  • Ben (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?

    It depends where the fuel goes and how much there is.

  • Peter (unregistered) in reply to Ozz
    Ozz:
    anon:
    I'd find the weight of the 747 by reading the service manual. That's the right answer, right?
    You left the service manual in your other pants. Now what do you do?

    Phone a friend

  • (cs) in reply to Anon
    Anon:
    The water question isn't even a brain teaser. Just a little proof of whether or not you read a book of brain-teasers before. Sure, a few people will solve it without knowing the answer beforehand, but probably not without wasting a lot of precious interview time doing the arithmentic in their heads.

    Perfectly said!

    I hate "brain teasers" and logic puzzles. I am absolutely terrible at them. They make my brain hurt. Yet I am an excellent software engineer. I can design and implement very complex software systems with ease. The logic and experience required for software engineering bear no relationship to those god-awful brain teasers. Interviewers and particularly HR personnel interviewers, have no clue what they're doing when they use those puzzles as an interviewing tool.

  • (cs) in reply to drachenstern

    I fill the 5 gallon container. I drink one gallon. 4 gallons left.

  • ollo (unregistered) in reply to Me
    Me:
    And everyone knows you weigh a 747 by putting it in a bath and weighing the displaced water.

    OK, the 747 sinks, now what?

  • (cs) in reply to Dennis
    Dennis:
    the UNWRITTEN assumption is that the 4 gallons has to end up in the 5-gallon container.

    But what if the 4 gallons has to end up in the THREE gallon container!? Now THERE's a puzzle!

  • FuBar (unregistered) in reply to Wesha
    Wesha:
    1) The dying person might be Hitler
    You're just tempting us with Godwin's Law, aren't you. So close, but yet so far.
  • (cs) in reply to DeepThought
    DeepThought:
    Or has a sever case of carpal tunnel syndrome.

    Wow, poor guy. The carpal tunnel was so bad he had to chop off his hand!

  • (cs) in reply to Kef Schecter
    Kef Schecter:
    I came up with a "lateral thinking" solution, though it does require the bottles to be transparent or translucent (but the problem description implied they were):
    0. Get a Sharpie
    0b. Fill the small bottle and empty it into the large bottle.
    1b. Label the large bucket with a line and mark the three gallon line. Empty the large bottle.
    1. Fill the large bottle. 2. Fill the small bottle with the large bottle. The large bottle now has two gallons.
    2b. Mark the large bottle with the Sharpie. Label the line 2.
    3. Empty the small bottle and fill it with the two gallons. 4. Mark the two-gallon mark on this bucket as well.
    4b. Label this line 2 as well.
    5. Fill the small bottle, empty it into the big bottle (so it now has 3 gallons). 6. Fill the small bottle again.
    6b. Empty the small bottle into the large bottle again. The large bottle, being full, has 5 gallons of the six. The small bottle now has 1 gallon. Mark the smaller bottle to know where 1 gallon is. Label that line as 1.
    6c. Now pour out all the water from both buckets, use the small bucket to finish labeling the larger bucket with 1 and four gallon marks for future reference.
    Now nobody else will ever struggle with having to remember how to get 4 gallons in the large bucket.
    QED
  • moz (unregistered) in reply to charliebob
    charliebob:
    Off the top of my head, I think the gross weight of an unladen B-747 is around 200 Tonnes. I could be wrong though...
    Perhaps an unladen one is. Unfortunately, some muppet has filled this one with water while trying to drown it in a lake.

    I'd just drive it to a weighbridge, myself.

    As for the water problem, I can think of two ways of doing it.

    1. Put the two empty bottles on the scales mentioned in the problem, and fill one side or the other with water until they balance. Fill the larger bottle with water. Fill the smaller bottle with the larger bottle. If the smaller bottle was heavier when empty, pour the water out of it, pour the water from the larger bottle into it and refill it. If not, do nothing.

    Then make a small hole near the top of whichever bottle isn't sitting in a pool of water, taking care that any debris falls on the scale. Wait for the water to stop running out and dry that side of the scales off. Repeat until the scales balance. You now have four gallons of water split between the two bottles, and you may or may not have a usable five gallon bottle to put them in.

    1. Fill the smaller bottle almost to the brim. Put a thermometer in it and carefully note the temperature. Fill the bottle to the top. Put the bottle in a cryogenic freezer. Take it out again when the water reaches 4 gallons. You may or may not be able to fit this water in the five gallon bottle.
  • (cs) in reply to Anon
    Anon:
    Also, wasn't this puzzle from Lethal Weapon, not Die Hard? I seem to vaguely remember Danny Glover and Mel Gibson doing this and they had to fill the containers from the basin of a fountain or a bomb was going to explode.
    No, it was Die Hard 2, this was between the cab ride and the ballpark clue.
  • James (unregistered) in reply to BentFranklin
    BentFranklin:
    ... per post

    'Reply' = there will be a little thing in top right corner that says 'In reply to <link>'

    'Quote' = 'Reply' + include OP's post

  • Anon (unregistered) in reply to drachenstern
    drachenstern:
    Anon:
    Also, wasn't this puzzle from Lethal Weapon, not Die Hard? I seem to vaguely remember Danny Glover and Mel Gibson doing this and they had to fill the containers from the basin of a fountain or a bomb was going to explode.
    No, it was Die Hard 2, this was between the cab ride and the ballpark clue.

    Ok, that sounds right. I remember them rushing all around the city solving stupid puzzles. The bad guy must have been an HR person.

  • Darren (unregistered) in reply to BradC
    BradC:
    Remy Porter:
    And honestly, I'm not really certain what the "right" answer is to the 3/5 gallon problem. My answer? Put the 3 gallon container in the 5 gallon container, fill the 5 gallon container. Take the 3 gallon out, and put the two gallons you just made into the 3 gallon container. Repeat, but this time pour the 2 gallons in the 3 gallon container into the 5 gallon container.
    I like the nested container idea, but when I first read your solution, I read it as "put 5 gallons into the nested 3/5 set, filling both containers", which obviously doesn't work. You'd need to either cap the 3 gal container so it doesn't get any water in it, or make sure its opening floats exactly level with the top of the 5-gal. Either way, you're fighting the buoyancy of the container, and you're unlikely to get a really precise result.

    Also, unless the thickness of the containers is negligible, you'd get slightly less than 2 gal in the 5 gal container.

    Actually, it just occurred to me that the easiest way would be to turn the 3-gal container upside-down, and hold it to the bottom of the 5-gal container.

    Edit: but then, its hard to "repeat" that with 2 gal in the 3-gal container....

    It wouldn't matter if the 3 gallon one was full or filled in the process (although you might find a little is wasted as you remove it)

  • Darren (unregistered) in reply to Darren
    Darren:
    BradC:
    Remy Porter:
    And honestly, I'm not really certain what the "right" answer is to the 3/5 gallon problem. My answer? Put the 3 gallon container in the 5 gallon container, fill the 5 gallon container. Take the 3 gallon out, and put the two gallons you just made into the 3 gallon container. Repeat, but this time pour the 2 gallons in the 3 gallon container into the 5 gallon container.
    I like the nested container idea, but when I first read your solution, I read it as "put 5 gallons into the nested 3/5 set, filling both containers", which obviously doesn't work. You'd need to either cap the 3 gal container so it doesn't get any water in it, or make sure its opening floats exactly level with the top of the 5-gal. Either way, you're fighting the buoyancy of the container, and you're unlikely to get a really precise result.

    Also, unless the thickness of the containers is negligible, you'd get slightly less than 2 gal in the 5 gal container.

    Actually, it just occurred to me that the easiest way would be to turn the 3-gal container upside-down, and hold it to the bottom of the 5-gal container.

    Edit: but then, its hard to "repeat" that with 2 gal in the 3-gal container....

    It wouldn't matter if the 3 gallon one was full or filled in the process (although you might find a little is wasted as you remove it)

    OOPS - second time round that could be a problem....

  • (cs) in reply to Zapp Brannigan
    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.

  • Belle (unregistered) in reply to drachenstern
    drachenstern:
    Anon:
    Also, wasn't this puzzle from Lethal Weapon, not Die Hard? I seem to vaguely remember Danny Glover and Mel Gibson doing this and they had to fill the containers from the basin of a fountain or a bomb was going to explode.
    No, it was Die Hard 2, this was between the cab ride and the ballpark clue.

    Die Hard 3, actually. With Bruce Willis (of course) and Samuel L. Jackson.

  • Anon (unregistered) in reply to RogerInHawaii
    RogerInHawaii:
    Anon:
    The water question isn't even a brain teaser. Just a little proof of whether or not you read a book of brain-teasers before. Sure, a few people will solve it without knowing the answer beforehand, but probably not without wasting a lot of precious interview time doing the arithmentic in their heads.

    Perfectly said!

    I hate "brain teasers" and logic puzzles. I am absolutely terrible at them. They make my brain hurt. Yet I am an excellent software engineer. I can design and implement very complex software systems with ease. The logic and experience required for software engineering bear no relationship to those god-awful brain teasers. Interviewers and particularly HR personnel interviewers, have no clue what they're doing when they use those puzzles as an interviewing tool.

    It depends on how you use them. If you give a "brain teaser" and expect the interviewee to come back with the right answer and if they don't you take that as a mark against them, then that is, frankly, retarded. If on the other hand, you give the "brain teaser" as a chance to see how the person thinks, see how they respond to an abstract problem, see what questions they ask. Then I think it's a valid thing to do. Take some of the non-answers on this thread. Some, I think, are good and show real intellect. Some are deliberately obtuse attempts to cheat and redefine the problem or else be a smart ass. I think the weight the jumbo jet problems actually might be better. Since you probably don't have the real answer, the question is more about the process and you should probably have multiple answers from a good candidate.

  • Anonymous coward (unregistered) in reply to Me

    Done.

  • Anon (unregistered) in reply to Belle
    Belle:
    drachenstern:
    Anon:
    Also, wasn't this puzzle from Lethal Weapon, not Die Hard? I seem to vaguely remember Danny Glover and Mel Gibson doing this and they had to fill the containers from the basin of a fountain or a bomb was going to explode.
    No, it was Die Hard 2, this was between the cab ride and the ballpark clue.

    Die Hard 3, actually. With Bruce Willis (of course) and Samuel L. Jackson.

    White guy and a black guy, makes sense. Oddly enough according to imdb (http://www.imdb.com/title/tt0112864/trivia) Die Hard: With a Vengeance was originally consider as a sequel to Lethal Weapon.

  • doo is (unregistered) in reply to drachenstern
    drachenstern:
    Kef Schecter:
    I came up with a "lateral thinking" solution, though it does require the bottles to be transparent or translucent (but the problem description implied they were):
    0. Get a Sharpie
    0b. Fill the small bottle and empty it into the large bottle.
    1b. Label the large bucket with a line and mark the three gallon line. Empty the large bottle.
    1. Fill the large bottle. 2. Fill the small bottle with the large bottle. The large bottle now has two gallons.
    2b. Mark the large bottle with the Sharpie. Label the line 2.
    3. Empty the small bottle and fill it with the two gallons. 4. Mark the two-gallon mark on this bucket as well.
    4b. Label this line 2 as well.
    5. Fill the small bottle, empty it into the big bottle (so it now has 3 gallons). 6. Fill the small bottle again.
    6b. Empty the small bottle into the large bottle again. The large bottle, being full, has 5 gallons of the six. The small bottle now has 1 gallon. Mark the smaller bottle to know where 1 gallon is. Label that line as 1.
    6c. Now pour out all the water from both buckets, use the small bucket to finish labeling the larger bucket with 1 and four gallon marks for future reference.
    Now nobody else will ever struggle with having to remember how to get 4 gallons in the large bucket.
    QED
    1. Fill both bottles.
    2. Interpolate.
  • cod3rgirl (unregistered) in reply to Patrick
    Patrick:
    Does the Senior Programmer have no hands with which to type? That would certainly explain the need to dictate to a typist, and a typist who actually understands the code enough to not cause frustration in debugging and formatting.
    actually, my first thought when i read this was that mr. senior programmer was disabled somehow, and couldn't type well. either that, or he's such a germophobe that he won't touch keyboards...
  • RandomUser423670 (unregistered) in reply to Wesha
    Wesha:
    Don't you realize? The Founder is a die hard programmer. But he has lost his vision.

    Did ANY ONE OF YOU EVER THINK how YOU will fuel your passion for computing if this ever happens to you?..

    The same way one programmer I've met did. Braille "display" and touch-typing.
  • A/C? si (unregistered) in reply to Belle
    Belle:
    drachenstern:
    Anon:
    Also, wasn't this puzzle from Lethal Weapon, not Die Hard? I seem to vaguely remember Danny Glover and Mel Gibson doing this and they had to fill the containers from the basin of a fountain or a bomb was going to explode.
    No, it was Die Hard 2, this was between the cab ride and the ballpark clue.

    Die Hard 3, actually. With Bruce Willis (of course) and Samuel L. Jackson.

    You fool! It was clearly Die Hard 1, between the dead guy falling on the police car and Professor Snape blowing up the roof.

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

    Isn't that how they lost a Mars probe?

  • Devil's Advocate (unregistered) in reply to RogerInHawaii
    RogerInHawaii:
    Anon:
    The water question isn't even a brain teaser. Just a little proof of whether or not you read a book of brain-teasers before. Sure, a few people will solve it without knowing the answer beforehand, but probably not without wasting a lot of precious interview time doing the arithmentic in their heads.

    Perfectly said!

    I hate "brain teasers" and logic puzzles. I am absolutely terrible at them. They make my brain hurt. Yet I am an excellent software engineer. I can design and implement very complex software systems with ease. The logic and experience required for software engineering bear no relationship to those god-awful brain teasers. Interviewers and particularly HR personnel interviewers, have no clue what they're doing when they use those puzzles as an interviewing tool.

    The bit in bold is exactly the problem. Too many people implement overly complex solutions (admittedly with ease). Some of the discussion seen here on the water problem illustrates that there can be more than 1 approach to a solution. Jumping headfirst into the most complex is not necessarily a good thing.

    That said, I agree, for the most part brain teasers are a crock because they put someone who has come across them before at an advantage (not to mention, someone who has come across them before probably enjoys them and so does them all the time). Similarly, someone who often sits IQ tests will appear to have a higher IQ than someone sitting one for the first time. Neither is a measure of your ability to think...

  • Sergeant Schultz (unregistered) in reply to FuBar
    FuBar:
    Wesha:
    1) The dying person might be Hitler
    You're just tempting us with Godwin's Law, aren't you. So close, but yet so far.

    Isn't Hitler dead already?

  • Bruce (unregistered) in reply to drachenstern
    drachenstern:
    Anon:
    Also, wasn't this puzzle from Lethal Weapon, not Die Hard? I seem to vaguely remember Danny Glover and Mel Gibson doing this and they had to fill the containers from the basin of a fountain or a bomb was going to explode.
    No, it was Die Hard 2, this was between the cab ride and the ballpark clue.

    I thought it was Die Hard 3 (Die Hard with a Vegetable)

  • Mr Digby (unregistered)

    It's obvious noone here likes salesmen..... I would've thought the most obvious would be:

    1. Fill both bottles (so you have a combined total of 8 2) gallons).
    2. Get your sales team to convince the customer that they need twice as much water.
  • (cs) in reply to Sergeant Schultz

    So is it only me or the first-guess answer is:(#1=3 gallons #2 = 5 gallons) fill #2 pour #2 to #1 until it is full 2 gallons left in #2, note the water leve(or hold your finger there, make a mark, whatever) empty #1 pour all #2 to #1 fill #2 up to the mark(2 gallons) pour #1 in #2

    Odd shaped container does not prevent you from marking water level.

  • Wag (unregistered) in reply to Sergeant Schultz
    Sergeant Schultz:
    Isn't Hitler dead already?
    That's what They want you to believe!
  • N (unregistered) in reply to Chris

    Duh

  • Xythar (unregistered)

    The comments on this article have convinced me that it's easier to complain than do anything, even solve an incredibly easy mental puzzle.

  • (cs) in reply to Belle
    Belle:
    drachenstern:
    No, it was Die Hard 2, this was between the cab ride and the ballpark clue.
    Die Hard 3, actually. With Bruce Willis (of course) and Samuel L. Jackson.
    My apologies, I should've known better than to make that gaff. Two was in the airport. Those two DO like to do movies together don't they?

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