Hacker News new | ask | show | jobs
by zeidrich 4252 days ago
I think the purpose of the puzzle is one of resource management.

It's not a hard puzzle, and I think that it's too easy to try to overthink it to sound smart, like you've done.

The reasonable assumption is that the four people are on one side of the bridge, and you want to have them all on the other side of the bridge.

The simple answer is that the person that takes 1 minute to cross goes with all of the other people, and then brings the torch back for the rest.

So 10 minutes, 1 back, 7 minutes, 1 back, 2 minutes. Total of 20 minutes.

There isn't anything technically specifying that they have to end up on the opposite side of the bridge at the end, but you wouldn't have a situation where someone really wanted to cross the bridge and end up where they started without a torch, and it indicates that the four people have one torch, which implies that they're a party of 4, not 2 groups on opposite sides of the bridge.

I think it's a good question, because it judges the state of the person being interviewed. Are they just scared away by a simple puzzle? Do they come up with some contrivance to try and show off how smart they are? Do they just come up with a practical solution?

Personally, I'd give the practical answer and say 20 minutes, give or take a bit for transferring the torch and turning around. I'd make the assumption that they were all on one side of the bridge and want to go to the other.

When you're given a request to send a request across a network and send a confirmation across the network, you're not going to go and send the some of the requests to the server, and some of the requests to the client, and some of the responses to the server, and some to the client, just because, despite the implied context, you decided that you could make it a bit faster by doing something that didn't make sense because it technically followed the rules.

You probably think your answer is still better, and that's why it's a decent question.

2 comments

"The reasonable assumption is that ..."

Sometimes these questions are explicitly asked to see if the candidate will check the assumptions when there can be more than one, even if one is fairly obvious.

> So 10 minutes, 1 back, 7 minutes, 1 back, 2 minutes. Total of 20 minutes.

21 minutes.