posted
When the correct answer is confirmed, the winner posts a new riddle.
I'll start:
Who makes it, has no need of it. Who buys it, has no use for it. Who uses it can neither see nor feel it.
Posts: 4174 | Registered: Sep 2003
| IP: Logged |
posted
Someone at a party introduces you to your mother's only sister's husband's sister-in-law. He has no brothers. What do you call this lady?
Posts: 32919 | Registered: Mar 2003
| IP: Logged |
I don't really have any riddles... I'll give you a brain teaser but that may not really be what's desired.
You have two strings that burn at random velocities (i.e. the time it takes to burn a string will not necessarily be twice the time it takes to burn half of that string), given no other timing device, and only matches, how do you use those two strings to determine when 45 minutes has passed (and now sun-dial like answers )
posted
Light one string at both ends - it will burn in 30 minutes if you do that.
Light the other string at one end at the same time. When the first string is burnt up, there will be 30 minutes of time left on the second string, no matter how much of it is actually burnt up at that point.
Light the second end of the second string; when the second string is consumed, 15 minutes will have elapsed (half of the remaining 30 minutes).
Dagonee Edit: Riddle incoming in a couple minutes.
posted
There are three cups of cofee and 22 lumps of sugar. How can you add an odd number of lumps of sugar to each coffee cup if each lump of sugar must be used in a coffee cup?
posted
I quite enjoyed solving the rope riddle as well, as well as another Microsoft interview question (I was chatting with a MS intern), but its too CS oriented to post.
Posts: 15770 | Registered: Dec 2001
| IP: Logged |
If you're flying in your canoe and the wheels fall off, how many oranges does it take to build a house?
Posts: 279 | Registered: May 2004
| IP: Logged |
You have a linked list. First, design a program that discovers if the linked list is/has a loop.
Second, design a program that does the same thing in the same finite amount of memory regardless of list size.
Posts: 15770 | Registered: Dec 2001
| IP: Logged |
posted
It's a drunk joke. Ask them this one and they will try to "essplain" their answer or say they understand yours.
The answer? Three, because elephants don't lay eggs on Tuesdays when it rains.
I pass on the right of asking the next riddle.
As far as the line "Who's Oedipus?" goes: he was a young man who was challenged by the sphinx to answer the riddle or die. It is from the play Oedipus Rex. In it, an oracle prophecies that a baby will kill his father and marry his mother. The boy's father attempts to have him killed, but the person assigned the duty takes pity and allows the child to live. He grows up and has several adventures, including killing his father and marrying his mother. When he does find out the truth of his parentage, he kills himself. Freud uses this story to name his bogus Oedipus complex, where he says that all men want to sleep with their mothers.
Posts: 279 | Registered: May 2004
| IP: Logged |
posted
OK, Fugu, I have two different answers for you depending, if the loop is garunteed to be a full circle (shape of an O) there's answer A, if the circle can start anywhere (like a 'P') then there's answer B.
Both answers in C++, but the language doesn't reall matter.
posted
*looks at C++ code and curls up into a little ball, quivers and cries softly at flash-backs of programming class*
Posts: 312 | Registered: Mar 2004
| IP: Logged |
posted
The loop can be anywhere, and the second answer is incorrect.
Edit to "clarify": the second answer is incorrect for either part of the question, though its logic could be used to answer the first part correctly (of course, there's a much easier if more memory intensive way; but we can use as much memory as we want for the first part). Its nowhere near the right answer for the second part of the question, though its closer to the right method of thinking than the easy answer for the first part of the question.
posted
No, it doesn't take a static amount of memory regardless of size. It takes a static amount of memory as long as the list's size is less than the largest value of an int. Then it just fails. And once you use a non-bounded substitute it takes an amount of memory proportional to the length of the list, which is unbounded.
posted
You realize I could get around that by declaring a "T *Counter", since the pointer is garuneteed to be of adequate size, or the rest of the program would crash first.
Am I allowed to change the pointers themselves?
And Becky, just because it's you and for no other reason my guess is: a horse.