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

  • the beholder (unregistered) in reply to drachenstern
    drachenstern:
    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?
    unless we're in the same (or a similar) predicament as the movie, I would personally goto <insert name of local grocer / mass market retailer of beverages> and BUY 4 gallons of water. A gallon of water at most grocers is ~$1 so I'm out $4. As a programmer in a respectable firm, if that $4 costs me too much, I've got other issues.

    Whaddaya need 4 gallons for anyways? The 5 shoulda been enough. Ya can always throw the extra gallon out the door.

    Hah! I'm not hiring you now, because your answer wastes money. Unless it's your money, of course.

    But if it's my money, why would you buy 4 gallons of water, when you can just buy one and use the 3 gallon water bottle?

  • someGuy (unregistered)

    wow small world!, so I know Braxton (the guy from the craig's list posting). He has severe carpal tunnel

  • (cs) in reply to the beholder
    the beholder:
    drachenstern:
    A gallon of water at most grocers is ~$1 so I'm out $4. As a programmer in a respectable firm, if that $4 costs me too much, I've got other issues.

    Whaddaya need 4 gallons for anyways? The 5 shoulda been enough. Ya can always throw the extra gallon out the door.

    Hah! I'm not hiring you now, because your answer wastes money. Unless it's your money, of course.
    drachenstern:
    Yeah, my own money, pretty sure I nailed that the first time around. Now, if you need to replicate the process repeatedly you need an engineer, not a software guy. Granted, I like to build mechanical contraptions, but...

    But if it's my money, why would you buy 4 gallons of water, when you can just buy one and use the 3 gallon water bottle?

    drachenstern:
    why do you need explicitly four gallons? Why can't you use the 5 gallon almost full? Seriously, the requirement is dumb to begin with.
    Glad to know you don't hire people because they're efficient. I always admire the zombies in FPS who walk into walls persistently. Do your employees need to be reminded to wipe their asses or wash their hands after using the toilet? "Just do what I asked, don't think about it"... may have worse implications than expected.

    </rant>

    eh... I feel woozy. What just happened there?

    [image]
  • whichgallon (unregistered)

    I'd fill the 5 gallon jug completely, if it's 5 US gallons. That's still 4 Imperial gallons.

  • (cs) in reply to Remy Porter
    Remy Porter:
    Why not, it works, doesn't it? So long as the walls of the container are thin negligible to the volume of the container, you're all good.
    The original problem specified bottles which would mean the orifices are too narrow for insertion.
  • Rowan (unregistered) in reply to bottlefiller

    I have a slightly faster solution to the bottle problem.

    #1 #2 3 5 0 5 Fill #2 3 2 Fill #1 from #2 0 2 Empty #1 2 0 transfer the 2 from #2 to #1 2 5 Refill the #2 3 4 Top off #1 from #2, leaving 4 gallons behind.

  • Da' Man (unregistered)

    DEFINE 5 4;

  • (cs) in reply to Name
    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

    But that is an even number of steps.

  • St Mary's Sanatorium for Severed Hands (unregistered)

    Did anybody read this?

    The Pair Programmer is critical since the Senior Programmer aims to limit his use of the keyboard.

    This fits well with somebody who has carpal tunnel syndrome. I think dictating program code to be a WTF, but would it be more sensible to

    a) hire a junior programmer who does all the "dirty" work

    and

    b) let the senior one work out the tricky stuff - albeit writing these bits by himself? At least he could sketch his ideas with good ol' pencil and paper and leave the implementation to his junior.

  • Lennart (unregistered) in reply to 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.

    Was it a european or african 747?

  • (cs) in reply to Rowan
    Rowan:
    I have a slightly faster solution to the bottle problem.
    #1 #2
    3  5
    0  5   Fill #2
    3  2   Fill #1 from #2
    0  2   Empty #1
    2  0   transfer the 2 from #2 to #1
    2  5   Refill the #2
    3  4   Top off #1 from #2, leaving 4 gallons behind.
    but then you have 7 gallons, not four!!!
  • (cs) in reply to SenTree
    SenTree:
    blem specified bottles which would mean the orifices are too narrow for insertion.

    Most expressions of that problem aren't that specific. Yes, in the case of bottles, that likely means the tops are too narrow. But then again, they are oddly shaped. This implies that our general assumptions about the bottles aren't safe, and that the bottleneck of the larger bottle could easily be large enough to insert a 3 gallon bottle.

    If the problem doesn't want the containers married, it should have specified it as impossible, not simply implied it.

    The issue is this: the "right" answer is tedious and boring. Bah, pour, empty, pour, empty. And it's tied to implementation- it'd be far more fun to solve the problem for any combination of containers and target volumes.

  • (cs) in reply to Anon

    ...and get 4 litres instead of 4 gallons?

    bzzzzt... next!

  • (cs) in reply to St Mary's Sanatorium for Severed Hands
    St Mary's Sanatorium for Severed Hands:
    Did anybody read this?
    yes, but to be fair, it was rather `tl;dr` (or `tl;<shouldn't have>r`

    Guy should just hire a secretary. <!--This actually has side benefits if he pays well enough and she's (ASSumptions) cute and it's his hands that give him fits. * --> Seriously, they can be trained to transcribe code as well as anyone can. Does he really want to see the code in realtime as he dictates it?

    Dragon Naturally Speaking not working?

    Chorded keyboard too much to ask to work one-handed?

    Perl won't suffice? (joke about all things in perl being reducable)

    There, are we happy now?

    • Yes, I know about the site BBCode and HTML inlining. You really thought I would be surprised by this? You MUST be new here.
  • (cs) in reply to Remy Porter
    Remy Porter:
    The issue is this: the "right" answer is tedious and boring. Bah, pour, empty, pour, empty. And it's tied to implementation- it'd be far more fun to solve the problem for any combination of containers and target volumes.
    I smell a programming praxis coming on...
  • DeepThought (unregistered) in reply to Patrick
    Patrick:
    Does the Senior Programmer have no hands with which to type?

    Or has a sever case of carpal tunnel syndrome.

  • Matt (unregistered) in reply to Anon

    Not to mention the fact that that would give you 4 litres not 4 gallons and we don't know if we are dealing with US or Imperial gallons.

  • (cs)

    Fill the 747 with water, place it on a scale, fill the 5 gallon container from the 747... wait, what was the question again?

  • Matt (unregistered) in reply to Anon
    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.

    Not to mention the fact that that would give you 4 litres not 4 gallons and we don't know if we are dealing with US or Imperial gallons.

  • BentFranklin (unregistered) in reply to AndersI

    Then you'd have a little over 1 gallon. UNIT WEIGHT FAIL!

  • Matt (unregistered) in reply to Matt
    Matt:
    Not to mention the fact that that would give you 4 litres not 4 gallons and we don't know if we are dealing with US or Imperial gallons.

    Ah! So that's what the "Quote" button does.(D'Oh)

  • Lennart (unregistered) in reply to Matt

    1- Weigh the 5 whatever bottle. 2- Fill the 5 whatever bottle. 3- Wiegh the 5 whatever bottle again. 4- Divide the difference by 5.

    A universal solution for a subset of your problems!

  • (cs) 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.
    Who would have thought one gallon weights one kilogram... Oh, wait...
  • ceiswyn (unregistered)

    And yet another alternative:

    #1 #2 3 5 3 0 Fill #1 0 3 Transfer the water from #1 to #2 3 3 Fill #1 1 5 Fill #2 from #1 1 0 Throw away the water in #2 0 1 Transfer the water from #1 to #2 3 1 Fill #1 0 4 Voila.

    Has the advantage that the water's only ever going in one direction, too.

  • BentFranklin (unregistered)

    If Reply isn't comment-specific, why is there one button per port?

  • (cs) in reply to Remy Porter
    Remy Porter:
    SenTree:
    blem specified bottles which would mean the orifices are too narrow for insertion.

    Most expressions of that problem aren't that specific. Yes, in the case of bottles, that likely means the tops are too narrow. But then again, they are oddly shaped. This implies that our general assumptions about the bottles aren't safe, and that the bottleneck of the larger bottle could easily be large enough to insert a 3 gallon bottle.

    If the problem doesn't want the containers married, it should have specified it as impossible, not simply implied it.

    The issue is this: the "right" answer is tedious and boring. Bah, pour, empty, pour, empty. And it's tied to implementation- it'd be far more fun to solve the problem for any combination of containers and target volumes.

    Absolutely. And I forgot the </pedant> tag on my post - I've just been reviewing some design documents and forgot to reset my brain !

  • BentFranklin (unregistered)

    ... per post

  • Marc B (unregistered) in reply to Jeff Dege
    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.

    Well played. And if they tell you that you aren't strong enough, you can challenge them to produce a 747 so that you can prove that you can indeed lift it.

  • Bluesman (unregistered)

    Apparently there are different versions 747s:

    http://en.wikipedia.org/wiki/Boeing_747

    So next time this happens during an interview, just ask them to specify what version.

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

    I didn't have time to read the rest of the comments, but 1 gallon doesn't weigh 1 kg. Plus we don't know if it is a US or Imperial gallon.

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

    Under. A gallon is ~4.6 litres.

    UNIT VOLUME FAIL!

  • (cs)

    If someone asks for something esoteric like "I want exactly 4 gallons of water, not 3 and 5 is right out (even though I don't care if you have to waste water in the process). Oh and you have to use these specific and difficult to work with receptacles to measure the amount out, and don't use any other tools." then it would be amiss not to enquire as to why the requirements are so specific and exotic.

    This is crucial so that you can be sure your solution is suitable to their needs, because even if you created a solution that met the stated requirements, it would be irresponsible, as an informed expert, not to ask pertinent questions in cases where you think important relevant information has not been provided and there is a particular risk for the business (such as in spending an unnecessary amount of time developing an overly complex solution to a problem where the requirements can be greatly simplified, or that has been entirely misdiagnosed).

    If someone can't explain the significance of a request that odd and expect you to implement it without questioning it and without the submitter providing any rational for the request it's not a place a capable developer would is going to want to work in and would expect that the most of developers they will end up hiring are the sort who will lead them merrily straight off a cliff on the next team building exercise "because the map shows the path clearly continues here".

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

  • (cs)

    I hate the Boeing 747 question. It's one of those "A-ha!" questions. Either you know the correct reply, or you don't - there's no actual analysis or programming skills involved. I remember Joel Spolsky ranting about it, and he got that one right. Other "a-ha" questions I met during interviews include:

    • the depth of Thames under a bridge in London (reply: "under which one" to win),
    • 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) Here it is, smart boy: You tell the friend to drive the dying person to a hospital, while you stay at the bus stop with the hottie and start the sweet talk.
    • the woodchuck question, which is just silly. The water jugs problem is better, because it can be solved. It has an "a-ha" moment, when you have to stop adding numbers and think about substraction, but it's not impossible.
  • Me (unregistered) in reply to Jim the Electrician
    Jim the Electrician:
    Apparently I'm a fast typist, because the post was still available on Craigslist when I looked.
    The odd thing is, I'm not a fast typist, and I could still find the post.

    And everyone knows you weigh a 747 by putting it in a bath and weighing the displaced water.

  • neveralull (unregistered)

    Never heard the bus stop problem before, but it's obvious: give your car to your friend to take the dying person to a hospital, while you gallantly stay behind to keep the girl company.

  • Hans (unregistered) in reply to Anon
    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.

    So we have a universe consisting of two containers.

    Where do you get the water to fill the containers? The problem made no explicit mention of the presence of a tap.

  • Vic (unregistered) in reply to psuedonymous
    psuedonymous:
    You cannot put four gallons into these bottles because they are odd shaped.
    Maybe he assumed that not only is water quantised, but must maintain it's odd/even state.

    Regardless, for making such a truly terrible pun he should also never have been hired.

    Perhaps it is a homeopathic principle - the water remembers the shape of one of the containers, so can't be poured into the other.

  • Anon (unregistered) in reply to neveralull
    neveralull:
    Never heard the bus stop problem before, but it's obvious: give your car to your friend to take the dying person to a hospital, while you gallantly stay behind to keep the girl company.

    Nonsense, you run the dying person down. They are dying after all. Put them out of their misery.

  • usitas (unregistered) in reply to neveralull
    neveralull:
    Never heard the bus stop problem before, but it's obvious: give your car to your friend to take the dying person to a hospital, while you gallantly stay behind to keep the girl company.

    Nope. Wrong.

    You call an ambulance for the dying guy, give your friend bus fare, and f*** the girl in your car.

  • Anon (unregistered) in reply to 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?

  • (cs) in reply to Kiss me I'm Polish
    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.

    So I'm going to guess.

    I hand the keys to my friend to drive the dying person to hospital, while I stay and hand one of the two umbrellas I keep in my car to the woman, who will be so impressed by my thoughtfulness and selflessness that she falls instantly in love with me.

    (Yes, I do carry two umbrellas in my car. You may have my MG changed from a ZT to TF, but that bit won't change.)

    (And it's such a shame that everyone's mobile phones are inoperative, since that means we can't dial for an ambulance full of trained paramedics, which is possibly better for the patient than trying to get into a two seater.)

    What? You think I'd hand my keys to the woman? No way - I may love her as no-one has loved anyone before, but I don't trust her yet.

  • (cs) in reply to Hans
    Hans:
    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.
    So we have a universe consisting of two containers.

    Where do you get the water to fill the containers? The problem made no explicit mention of the presence of a tap.

    You are allowed to assume certain things in these questions you know. Like the presence of air to breathe. Just not things that the original question said were not available.

  • Anon (unregistered) in reply to Kiss me I'm Polish
    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)

    The tell the interviewer that you are happily married and angrily demand to know what they are trying to imply by suggesting that you'd instantly fall in love with another woman. Then you sue the company for sexually harassing you by basically implying that you're a swinger in an interview.

  • (cs) in reply to neveralull
    neveralull:
    Never heard the bus stop problem before, but it's obvious: give your car to your friend to take the dying person to a hospital, while you gallantly stay behind to keep the girl company.
    I've heard heard of that before either (and can't find any reference to it), but assumed that was the "correct" answer.

    Although - unless I knew I was near hospital, and had a good idea of how to get to it - I would stop and offer my friend a lift (given it's raining), phone an ambulance so that some professionals can attend to the dying person, and ignore the other woman as my GF wouldn't be very happy about me chatting her up.

  • Anon (unregistered) in reply to Bellinghman
    Bellinghman:
    What? You think I'd hand my keys to the woman? No way - I may love her as no-one has loved anyone before, but I don't trust her yet.

    Actually, you should hand the keys to the dying person. They'll get themselves to hospital if they really want it.

    Interestingly, I think this is the GOP's health care plan.

  • charliebob (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 ask my Dad who works on them... Or look it up on Wiki/Google...one will know :P

    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...

    Now the airspeed velocity of an unladen swallow...THAT'S a question!!!

  • (cs)

    The real WTF in the second story is that this "promising candidate" was presumably not even called in for an interview for failing to do some lame-ass trick puzzle question.

  • neveralull (unregistered) in reply to usitas

    I stand corrected

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 #303523:

« Return to Article