Skip to main content
GameDev.net gamedev.net
🔒 Locked

Can you give me some hints to solve this?

Started by Gage64 Feb 7, 2008 at 8:24 AM 60 replies 7.3k views
Original Post
Gage64
Gage64
This question was presented at an interview for a programming position (not to me). A friend told me about it, and I asked him not to tell me the solution because I wanted to try to solve it myself, but after thinking about it for awhile, I have no idea how. The question was (I hope I remember it correctly): You have two ropes (don't remember if they are of equal length or not...). Each one takes exactly 30 minutes to burn out. You cannot assume that the speed at which the ropes burn is constant. You need to measure 45 minutes by just using these ropes (and a box of matches). I was told that this doesn't involve any complicated math, just simple logic. I don't want the full solution, just some hints that will point me in the right direction. Thanks in advance. [Edited by - Gage64 on February 10, 2008 12:30:25 AM]
SiCrane
SiCrane
I've heard this one before. The ropes don't need to be the same length. Unfortunately, I can't think of any hints that don't give it away.
Stiffler
Stiffler
Hard to give a hint which doesn't give it away.

But here's a try:
It will take at least 3 matches (assuming each match can only light rope one time)
~Mark Schadler
Demosthenes
Demosthenes
MMm, this may not be that helpful, but ropes are not rigid.
Ravuya
Ravuya
It should be immediately obvious if you think of what you can do with a rope.

(Hint: Don't eat rope)
dmatter
dmatter
It's quite hard to give hints as SiCrane said. Try and think in terms of how you might measure 15 minutes.
Gage64
Gage64
Thanks for the hints, some of them are interesting (although I don't understand the "Don't eat rope" comment [smile]).

What really stumbles me is that you can't assume that a rope burns at constant speed. Maybe it's first half takes 29 minutes to burn, and it's second half burns in one minute (and for the second rope it might be different).

I don't particularly look forward to my first programming-related job interview, that's for sure. [smile]
dmatter
dmatter
Take all these hints with a pinch of salt. There's a few solutions, really variations on the same solution, but some people are just hinting towards the solution they thought of first.

For example, Demosthenes said that "ropes are not rigid." which hints towards some of the solutions, but the ropes could be rigid which was hinted at by Stiffler: "It will take at least 3 matches (assuming each match can only light rope one time)".

Individually they're good hints, but together they're more of an anti-hint.

The fact that rope isn't rigid is particularly useful from the interviewers perspective because it allows correct solutions to have different levels of optimisation.
Demosthenes
Demosthenes
Quote:
For example, Demosthenes said that "ropes are not rigid." which hints towards some of the solutions, but the ropes could be rigid which was hinted at by Stiffler: "It will take at least 3 matches (assuming each match can only light rope one time)".


You're right, there's a solution with rigid ropes. Is there more than two solutions to this problem, btw?
dmatter
dmatter
Quote:
Original post by Demosthenes
You're right, there's a solution with rigid ropes. Is there more than two solutions to this problem, btw?


Yes, but they just make use of different arrangements of rope and matches; think about how you would solve this with a single match used only once.
Like I said they're all variations on the same general idea really.
Sandman
Sandman
Quote:
Original post by Demosthenes
MMm, this may not be that helpful, but ropes are not rigid.


The question says that the ropes do not necessarily burn at a constant rate, which implies that some sections of any given rope might burn faster than others... which potentially invalidates the solution you're hinting at. If the solution you're hinting at is the same as the solution I think you're hinting at...


EDIT

or maybe you meant that with non-rigid ropes, you only need 1 match?

EDIT 2

I see you meant the latter... never mind

[Edited by - Sandman on February 7, 2008 1:25:53 PM]
ibebrett
ibebrett
its only a silly interview question, maybe its just test of just how long you'll spend worrying about something silly. Im sure they wouldnt want you burning the candle at both ends on stuff like this instead of working on their game right?
dmatter
dmatter
On the topic of logic puzzles, have you tried this one...

* 4 people are burried in a line, up to their necks in the ground, such that they are unable to turn their heads.
* There is a brick wall (opaque and non-reflective) separating 1 person from the other 3; it is not possible for anyone to see around this wall.
* They are not permitted to communicate with each other.
* They are informed that each person is wearing a hat and that 2 hats are white, 2 hats are black.
* They are unable to see their own hat or the hats of those behind them but they are assumed to know their own position amongst the other burried people.
* They are further informed that it is possible for just one of them to determine the colour of their own hat.

The arrangement of persons and hats is given diagramatically, where heads are distinguished by the direction they are facing using the < and > symbols, the wall is denoted by the | symbol and hats denoted as B or W:
B | W  B  W> | <  <  <1 | 2  3  4
To aid in referring to them, each person is enumerated from 1 to 4.

With the problem thus, which person is able to determine the hat they wear and how?


Assumptions to make:
No-one is blind.
No-one is stupid, these are intelligent people; they are NASA scientists for the sake of argument.
Every person is willing to try (variations on this puzzle give the incentive that they have 5 minutes and one attempt to figure this out, otherwise they get shot).

I think that covers everything.

It'd be more interesting to others if anyone who works it out or already know the answer doesn't post the answer [smile].
alnite
alnite
Eh, this should be pretty easy..only 3 matches.
sanch3x
sanch3x
Quote:
Original post by ibebrett
its only a silly interview question, maybe its just test of just how long you'll spend worrying about something silly. Im sure they wouldnt want you burning the candle at both ends on stuff like this instead of working on their game right?


Oh I see where you're getting at... *wink wink*
dmatter
dmatter
Not that it's a competition, but Sandman has already PM'd me a correct solution to the hat problem, congrats.
kseh
kseh
Maybe it's one of those outside the box sort of things. Sell the rope and buy a watch.
Iron Chef Carnage
Iron Chef Carnage
Yeah, the answer I gave was that I'd write a letter to my supervisor requisitioning $1.89 to buy a goddamn stopwatch.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.