Hacker News new | ask | show | jobs
by vultour 2874 days ago
Riddles are the worst, I was recently asked the "You have a 5 litre and a 3 litre container, how do you get 4 litres" question (never heard it before).

It's so simple to figure out if you're on your own and just play around with the idea. When asked on the spot I just kept thinking "hey these people want an answer NOW, don't make them wait" while feeling their stare, and couldn't figure it out without help.

3 comments

I guess if you are old enough you'll know that one from the movie. Doesn't mean you remember how they solved it (because what did I care at the time?). Nothing to do with programming unless someone asks you to write a short program to figure out the most efficient (least steps) on how to do it. Behind a computer.
Yup. Bruce Willis and Samuel Jackson were able to figure that one out. It can't be that hard. They were under a lot of pressure as well.
I have found the best course is to treat the interview as a situation where a colleague has come to me with a problem that we are hashing out together. I feel a lot less pressure with that mindset, though I do get thrown off by interviewers who take an adversarial approach. But I find this an acceptable loss.
{

t0:{[3,5],[0,0]},

t1:{[3,5],[0,5]},

t2:{[3,5],[3,2]},

t3:{[3,5],[0,2]},

t4:{[3,5],[2,0]},

t5:{[3,5],[2,5]},

t6:{[3,5],[3,4]},

}

Thinking about making this an algorithm, are we forced to use recursion?