# Wednesday, December 12, 2007

Bar of Gold

Bar of Gold is a fairly simple word problem I give people I interview for technical positions. It's not huge think question, IMHO. It's really designed to see if you can conjure a thought process. And while there are, I'm sure high fa luting ways to solve it, a straight forward brute force attack and you can't help but solve it. The most common response I get from candidates is to stare intently at the white board and make a face like that makes me hope their are wearing and adult diaper. The most successful candidates at this just start solving the problem out loud and quickly realize that by beginning to solve it you pretty much can't help but solve it. I know this, because I was presented this problem in an interview with a much higher value and I managed to solve it.

Here is the problem:

You have 1 bar of gold and 7 days of work to be done. You hire a man to do the work for you and agree to pay him 1/7th of your bar of gold a day. You must pay him in full at the end of every day. The problem is you can only cut the bar of gold in two places. Where do you make the two cuts in the bar of gold so that you can pay him properly each day?

Additional Info: Since you live in such a remote location the guy doesn't have any where to spend any of the money you pay him from day to day and because you don't provide your employees with lockers he carries all his gold on him.

My feeling is if you start to solve the problem using trial and error you'll come across the solution pretty quickly. If you stare at it, you invite an aneurysm.

Now the funny part. I had to write this down somewhere. A while back we did a mass intern interview where the candidates showed up anytime from 10 AM to 3 PM and during that window we would try and get them seen by at least 2 interviewers. The thing about intern interviews is that you can't really expect the students to have specific technical expertise, you're looking for good foundations in Computer Science and problem solving and communication abilities. That's why I like the bar of gold. You have to have problem solving abilities and explain to me how you arrived at the solution.

Well, there was one candidate who was exceptionally nervous to whom I gave this problem. He looked as if is head was going to explode until I repeated the question about 5 times clarifying the problem. He then proceeded to scribble down the following formula and then look up at me half triumphantly and half in uncertainty and more or less remarked, "there."

[ 1 - [ 1 - ( 1 - Δ 1/7) 1/7 ] 1/7 ]

There what? How did you arrive at this conclusion and what is the answer? Nothing. And while I'm not sure what that formula expresses, I'm reasonably confident it's not the answer.

In case you can't figure it out I'll leave the answer in the comments in a few days.

Answer posted in the comments 12/16/2007

Wednesday, December 12, 2007 10:38:41 AM (Eastern Standard Time, UTC-05:00)
#    Comments [1] |