Tech-Interview Riddles
An anonymous submitter writes "A computer engineering student at UC Berkeley has made a comprehensive archive of riddles from technical interviews. Very challenging and loads of fun. Also useful for interview preparation."
I believe Microsoft was responsible for popularizing the usage of riddles in interviews
Yes, but they still have not been able to find anyone who can solve the "why does windows crash" riddle!!
for more tech interview questions and answers try http://www.techinterview.org/
What's up with using this type of question for interviews, anyway? Sure, they can be fun, but they're perfectly useless as far as telling whether someone can actually write solid code. 9 times out of 10, all they tell you is whether the interviewee has heard that one before.
To interviewers: Do you really think that the answers to these questions don't spread through the entire department within 15 minutes after your first interview? I realize that "knowing the answer" makes you feel smarter than the prospective employee in some sense, but how about actually doing your job for a change?
I sampled a few of the "relatively hard" puzzles... They're interesting, but they only take a minute to figure out. Am I correct in thinking that these are relatively easy, or am I being an ass and flaunting my ability to solve little puzzles?
(In case of the latter, do you want to hire me? I live in Cleveland and go to Cornell University...)
I used to put this one on my programming tests. It's actually shocking how many people get it wrong...
You are writing a parser that reads a C program and translates all the variable names into new names of the form "VAR######", where ###### is an integer incremented for each unique variable name. Discuss what is needed for the case where the C program already contains a variable of the form "VAR######".
Sometimes it's best to just let stupid people be stupid.
It's Turing complete. It weeps, it bites, it smiles and it loves. It can be made, it can be had, it can be taken. It was one, it was two then it became sixty two. It needs time, it need paitence it needs to be pruned. When time comes it needs a fourier series to make it look good. What is it?
How much ground could a groundhog grind if a groundhog could grind ground?
I believe you are the guy on goatse.cx.
"Write a program that will display a "spiral" of NxN numbers, using constant space (no arrays allowed). For example, here's what the spiral looks like for N=10:"
... nice ...
And then he displays a spiral that's 11x10
We do not live in the 21st century. We live in the 20 second century.
A man would like to have safe sex with three women, any of whom may be carrying an STD. Given two condoms, how can he do so, while ensuring that no STD is passed from one woman (or possibly himself) to another (or to himself)?
This is a common situation on the job. Who says riddles aren't relevant in interviews?
January 1, 1970 0000 GMT is the standard *nix epoch, so the clock must have been set to zero at the time it spat up that little gem.
How can you use my intestines as a gift? -Actual Hong Kong subtitle.
A woodchuck would chuck as much wood as he could chuck if a woodchuck could chuck wood.
That's one of my dad's favorites.
Under capitalism man exploits man. Under communism it's the other way around.
The MS category has some real toughies, like:
"y do u think u r smart"
"y do u wanna work at Microsoft?"
and a great catalyst for catastrophe...
"If you could remove any of the 50 states, which state would it be and why?"
These toughies are gonna keep me up all night!
Google Cahce is Ace
Think about it.
A stick of incense takes exactly one hour to burn out. Given nothing but a lighter and three sticks of incense, how can you accurately measure 1 hour and 45 minutes of time?
What is:
Greater than god
More evil than the devil
Poor people have it
Rich people want it
If you eat it, you'll die?
If all you have is a hammer, everything looks like a nail.
Karnaugh Maps (brought to you by CSE 120 at ASU):
Your problem:
!B!C !BC BC B!C
A-----------------
0 | 0 0 1 0
1 | 0 1 1 1
Answer: BC | AB | AC
Ta da!
This is a great site for more information on interviewing at Microsoft. It has some sample questions, study materials and testimonials etc.
I.O.U One Sig.
I thought for days about this riddle, but it is impossible! I give up! Nothing could be the answer to that!
(and I'm a hiring manager)
I rarely find that people fall down on the job because they lack intelligence, especially the kind it takes to solve these riddles. Many people don't use the intelligence they have because of laziness, bad habits, or can't communicate what they know. Most people are smart enough to hide this in interviews, too.
The reason people can't do their jobs, 99% of the time, is they don't play well with others and/or have poor communication skills.
Give me an above average, hard working, honest, good communicator over that prima donna MIT grad anyday. Don't get hung up on the MIT example, it could easily be Stanford, UC Berkeley, or whatever. The point is that institutions like these select for intelligence, and let's face it high intellegence and good communications skills rarely go hand in hand. It's a beautiful thing, though, when they do. (Lucky bastards!)
Answers here (post more):
Q: Coin in bottle
A: Simply push the cork into the bottle and shake the coin out.
http://www.codewolf.com - Just good stuff to waste time
Come on, I've never heard that one but the answer's got to be "nothing".
I don't know what that says about the riddle, me or people who spend days thinking of the right answer but it's hardly a tough one is it?
(My apologies if this comes across as smug and arrogant, it's not meant to be. At the very least this post provides those that weren't as instantly inspired as myself with the correct answer.)
"Accept that some days you are the pigeon, and some days you are the statue." - David Brent, Wernham Hogg
Did they steal this from the Dr. Who "Pyramids of Mars" episode, or was it the other way 'round? Anyone know?
Also, pretty sure I figured this one out, but have no college math, & would appreciate a more technical answer.
So, if you flip the first 20 coins, and partition between 20 and 21, you have the best chance for success, right? Doesn't that mean that there is a 20/inf. and therefore a 1/inf chance that one of the tails coins is in the first 20?
std::disclaimer<std::legalese> sig=new std::disclaimer; sig->dump(); delete sig;
"What will it say in the newspaper about you when you die? In effect, write your own obituary:"
All-time best answer:
"Gunman shoots nine, then self."
My friens Marc *swears* he said this in an interview.
Cheers,
Jim in Tokyo
-- My Weblog.
older than this riddle
cheque
--
Evan
"$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien
You have a monopoly in a given market. A company creates a groundbreaking product and establishes a new, completely different market. Assuming you cannot buy the company, how do you smash it and extend your monopoly in the old market to the new one?
How would you go about designing an email client that executes any code that is sent to it?
If you could remove any of the fifty states (thus rendering federal antitrust statutes inapplicable to corporations in that state) which state would you remove and why?
How would you go about designing an operating system for people who hate computers and who just want to use their machines for pay-per-view entertainment?
An End User License Agreement (EULA) appears in a window with "I Agree" and "I Disagree" buttons. The text area in which the EULA appears is eighty columns wide. How many lines of text can be included in the EULA before a computer that just meets your system requirements is unable to load it into memory?
At a fork in the road between two cities, you see 2 people. One always tells the truth, and comes from the city of safety. The other person always lies and comes from the city of cannibals, where they will eat you. Which one do you hire to write up licensing agreements for your legal department?
An Arab sheikh is old and must will his fortune to one of his two sons. He makes a proposition. His two sons will use their computers, and whichever computer gets a blue screen of death first will win the fortune for its owner. During the race, the two brothers do nothing on their computers, neither willing to risk a blue screen of death. In desperation, they ask a wise man for advice. He tells them something; then the brothers immediately jump onto the computers and start installing new hardware, sharing files, and downloading hastily written security updates. What did the wise man say?
This was a nifty riddle, I never saw it before, and I do think it's appropriate for the programming mind set.
... you do nothing! You turn around and walk out! Look at it this way. All you joes are never going to turn the lamp off. Ever. That's Number's job. And each of you joes are going to turn on a dark lamp and make it bright exactly ONCE in your life. Just ONCE. No more, no less. If you can count up to 1, you can do this. Numbers has to count to 100, and I know he can handle that. And we'll all be out of here eventually."
Essentially the prisoners have to come up with some programs for themselves. They become little finite state machines with an unlimited number of internal states, one input bit, and one output bit. Then the jailer picks one prisoner at a time, randomly, and lets the prisoner run his state machine.
First I noticed that there aren't enough different truth tables for 100 prisoners, which led me to think about the state machines.
Then I looked around for some kind of protocol where prisoner #1 could signal that he had rendez-voused with the lightbulb, and then hand off a notional "token" to prisoner #2, and so on for 100 prisoners, eventually to make a token ring. That wasn't working out very well. I got up to 4 prisoners that way, and I wasn't coming up with a general mechanism.
Then I thought: okay, try client-server, make one prisoner the "boss" with one program, and 99 other prisoners are "drones" with a second program.
That worked out pretty well!
The next problem is communicating the strategy to the prisoners:
"Okay, all you mugs, listen to me, because I was a smart guy on the outside!"
"You, KILLER, you are the BOSS. It's your job to keep the count. Whenever you go in that room -- if the lamp is on, you turn it off, and you make another tally mark on your roster. If the lamp is off, you leave it off. When you get to 99 tally marks, you tell the warden that everyone's been in there, and we can all go".
"All the rest of you joes, listen up. If you go in the room, and the lamp is off, you turn it on -- but ONLY ONCE. JUST ONCE. After you do that, you never touch the lamp again. Ever. I don't care how many times you go in the room."
"All you joes -- if the lamp is already on, don't touch it. Leave it on. That just means that someone else turned it on and Killer here hasn't seen it yet. If the lamp is off, and you touched it before, leave it the hell off! Cause if you turn it on again, Killer's count is gonna get messed up, and we're all going to die."
"Killer, you got pencil and paper? Good. Maybe you want to tell Numbers here to do the counting instead? It doesn't matter who does it, as long as we all agree RIGHT NOW who's going to keep the count. Because if you blow the count -- either we are going to be waiting here forever, or you are going to pipe to the warden too soon and we'll all fry."
"Any questions?"
(One of my buddies has to be pre-arranged to ask this): "Yeah! What if I go in the room and the light's already on? What do I do?"
"Answer: you do nothing! You turn around and walk out! If you haven't turned on the light for yourself yet -- this doesn't count."
Q: What if I turned on the light and the jailer calls me back and it's still on?
A: "Same as above
Then we train the guys using a couple of decks of playing cards, and a lamp, so they can see how it works.
"So there's a programmer writing some code, in C. That programmer needs to use a buffer to store some data. How does the programmer write the code such that an unexpectedly large amount of data doesn't overwrite the stack and result in a remote root exploit?"
Because the holes are round.
I mean, really, any other shape wouldn't fit...
*ducking*
My video compression blog
.
* SPOILER *
.
* SPOILER *
.
* SPOILER *
The rule is: Turn on the light if it's off, unless you've already done this once, in which case, do nothing.
The day all 100 of you meet, designate one person to turn off the light. Have them count each light they turn off. When they reach 100, they will know everyone else has been out already, and can safely demand their freedom.
(Of course, assuming the warden really does pick someone at random, he could pick the same person every day, forever. Or not pick one person, every day, forever. Either way, there's no guarantee you're ever getting out.)
He who refuses to do arithmetic is doomed to talk nonsense.
I'd imagine it's the incredibly rare job held buy a guy who actually knows how to use what he's selling. =)
You're a racecar driver on a one mile track. You drive one lap, averaging 30 mph. How fast do you have to average on the second lap to get a total average speed of 60 mph over the two combined laps?
Some answers from the hard section:
.2 with an average payoff of $5. That means that the probability of getting a face card is .8 with a payoff of 11.5. Using more precise figures, i.e. not .2 and .8, the average payoff is about 10.0857 (706/70)
Criminal cupbearers:
Let's assume we only have 10 prisoners and that they each drink from up to 512 bottles. Number the bottles from 0 to 999. Prisoner 9 samples 0 to 511. Prisoner 8 samples 0 to 255 and 512 to 999. Prisoner 7 samples 0 to 127, 256 to 383, 512 to 639, etc. (prisoners alternating between sampling and not sampling blocks of wine in decreasing powers of 2 -- prisoner 0 drinks from every other bottle) Now line up the prisoners after onen month and treat corpses as ones and living prisoners as zeros and you have your answer in binary.
Mysterious Triangle area
Well, to make a long story short, they're not triangles.
100 Prisoners and a Lightbulb
Well if we assume they can all see the bulb every day, they can just toggle the bulb iff this is the first time they've been selected. If the last prisoner has counted the number of times the bulb has been toggled, he can assert that he is the last one to be selected.
Square Formation
Move the "notched" piece to teh righth of the current larger square and put the small square piece in the notch. put the larger of the triangular pieces at the top, horizontal edge of the new formation.
Calendar Cubes
I like this one. You need all the numbers from 0 through 9 plus 0 through 3. That's 14 faces. You will never need 00 though, so you can remove one of the 0s. Also, you will only ever need the 3 with 0 or 1, so you can remove it from one of the blocks. The solution: the numbers 1-6 on one block, and 7-9 and 0-2 on the other. Yeah it works.
Mystery Matrix
4. Entry from row plus Entry from row 2 plus 1 mod 10.
Fork in the road I
"is that the city you come from?" If the response is yes, go there, otherwise turn away.
Fork in the road II
Assume each person is standing on his respective road. "Is one of you a liar?" Yes means he's a truth teller, no means he's a liar.
Egg Dropping
18. Drop from the 10th, 20th, 30th, etc. After it breaks, go back 9 floors and start dropping every floor. You use 18 drops if it can drop from the 98th or 99th floors.
Greedy Pirates
It's not apparent to me that this is the intended answer, but "Throw pirates 3 and 4 overboard and divide up the rest between 1,2, and 5. Pirates 1 and 2 will agree to the largest share, and pirate 5 always has a say after that, since 3 and 4 can't agree to anything, so he's needed for the majority.
Hmm, well it's getting late so I'll just do one more:
Card Game
Bob takes any card over 9. The probability that none will show up is roughly
Am I the only one who thinks this interviewing technique is retarded?
Because Microsoft does something most definitely isn't a reason to emulate it. Microsoft isn't exactly known for producing well designed software, nor software that reuses proven patterns or algorithms that solved known problems 20 years ago. Better to hire a bunch of 21 year old college grads who can solve word problems from 8th grade algebra, and pretend that Microsoft invented computers! Whee.
When I hire developers I want them to be good developers, not promising young interns. My interview questions typically involve technology questions, process questions, some theoretical PROGRAMMING questions, and some social / communication questions. I'm not saying that hiring smart people is a bad idea, but ignoring skills and only looking at generic problem solving ability is a recipe for unbelievably bad code. It's like hiring musicians based on measured hearing sensitivity and reflexes. OK, maybe that matters if you want to figure out which 5 year old is going to be a prodigy, but hand them an instrument and the noise that comes out is going to sound like ASS.
Examples of things that "smart" developers I've worked with before have totally missed:
- the existence of more efficient data structures than arrays
- generalizing code into reusable chunks (functions, objects, whatever)
- regular expressions
- the difference between "client" and "server"
- the reason for using descriptive variable names
- collection libraries with built in sorting ("whatcha workin' on?" / "coding up a quicksort algorithm" / "in a J2EE app!?!?")
You can't just get this from reading a book, either, although that definitely helps. You have to have some degree of EXPERIENCE too: at least a few projects, and some awareness of things like performance tuning, security, coding for maintainability, etc.
I would use these "tech interview questions" only for hiring interns or recent college grads where the expectation is zero experience, zero clue, zero skill, and a correspondingly low salary. After all you're investing in someone. But for someone that commands a market rate developer salary in the high five figures, screw the brain teasers - just spend a couple of hours grilling them on skills, experience, discipline, etc. They will respect you big time in return because they know when you extend an offer that they won't be working with a bunch of dumb-asses who can get the explorers across the river without being eaten by the headhunters but who can't code their way out of a soggy paper bag.
Another good resource: the Princeton Mathclub
my other sig is a 500 page novel
There's many possible answers, so how do I know if I've got the answer they want? He's in a heavily forested area, so grabbing a log and paddling out around the fire shouldn't be hard. Or he could dig a little moat, though that might not be too effective. So, is there some other, clever answer, I should look for, or am I done? Grrrrrrrrr!
"I am a cipher, a cipher, wrapped in an enigma, smothered in secret sauce" -Jimmy James
Asking questions like this during an interview makes a mockery of the interview process, patronizes the candidate and is usually suggested by a career middle-manager seeking to assert their importance at the expense of the dignity of the candidate.
People's careers should not depend on the last five pages of a 99 cent brain teaser book.
The answer to all of them (in an interview) is "thanks for the coffee."
I printed it out and cut them up. It's late, but I'm just not getting it. Any hints?
It's under the hard difficulty.
The man who trades freedom for security does not deserve nor will he ever receive either. - Benjamin Franklin
So if ^ is XOR, what is AND?
Yes, these questions look exactly what Microsoft optimizes for: employees who are really "smart" in a Mensa-sort-of-way. Too bad that programming isn't about being "smart", it's about craftsmanship, taste, engineering tradeoffs, tradition, experience, and long-term dedication. And, not surprisingly, those are areas where Microsoft is sadly lacking.
I was once asked in an interview the following question in order to assert my UNIX administration capabilities:
"Name a sendmail exploit, past or present and quote a line from '2001'."
Since with two condoms on the likelihood of both breaking is pretty high.
Just have a co-ed circle jerk.
If it takes two men three and a half hours to build a brick wall, how long does it take twenty thousand men?
$time_now = unixtime(); // gives time in seconds from Unix epoch
// code // Prints time as DDMMYY hh:mm but notice there's no underscore
print "Last Modified: "+texttime($timenow);
then the second function would be passed an unset variable, which would be zero. That would give you 0000GMT, 1/1/1970.
This site contains answers to many of the microsoft questions.
i ?a ction=topics&number=3
http://www.acetheinterview.com/cgi-bin/qanda.cg
i suppose the answer to many riddles is, look it up on google?
For more of this kind of thing, I recomend a book called The Chicken from Minsk. It has some pretty tough questions, and they are posed in such a way that they often make you giggle.
"The new wave is not value-added; it's garbage-subtracted" - Esther Dyson, Dec 1994
Damn, that one is even hard to type!
For instance: Brown Eyes and Red Eyes. I have this sense that upon being told by the outsider 'at least one of you has red eyes' (no top limit to the number), ALL the monks go commit suicide at midnight. I can see they still can't communicate, and can't prove they're not among the not-red-eyed, but there are links in the logical chain missing here- yet it points to that result somehow, due to their non-self-awareness and the confirmation that there are red-eyes present.
By the same token- The mother is 21 years older than the child. In 6 years from now, the mother will be 5 times as old as the child. Question: Where's the father? I have to say: on top of the mother, conceiving the child- but I can't get the numbers to add up to anything sensible, it's just the only intersection that would give you the location of the father! *rrrrr*
And finally, 0.999999... is not 1.0000000.... really it's not, though in practice, well...
Although it's more circumstantial than anything, would it be possible that they wouldn't show you a losing door under certain circumstances and they would under others?
Ex: Would they only show you a losing door if you had chosen the winning door, to try to "coax" you away? Have you ever tried to see them convince you to pick the *right* door?
By this logic, it would be adviseable not to switch.
-kwishot
The one whose answer is 42.
I did a lot of interviews at MS when I was there, and I quickly learned not to ask riddles. First off, it makes people who don't get them uncomfortable and angry. Second, it doesn't actually show that the person can write software.
I used a much simpler approach, so simple most people think its silly. But thats the point; nobody leaves the interview thinking they were tricked or duped. I always started with implementation of strcpy(). Half of the candidates failed right there! They took most of the hour to get it right (or not), but were able to see point-blank that they were not ready for the job.
Next, I would ask about crashing cases, and if they figured out overlapping memory locations, have them write a 'fixed' version. This weeded out another big chunk. After that, I went into some color counting algorithms.
I stayed well withing the field of what the candidate would expect, and did not try to trick him or make him nervous with off the wall riddles.
This approach worked great, and didn't leave anyone feeling robbed and abused. The ability to solve riddles *is* an indicator of how smart the person is, but it is *not* an indicator of how good a programmer they will be.
Write a subroutine
quite an interesting language you chose to write it in.
The point is: reading the question correct is half the answer. You got only 50% correct.!
Aah....that's where this rubbish comes from is it? I got asked that question whilst interviewing for a job at a major US bank (in London). My answer was "manhole covers are round to fit round manholes, and beyond that I do not consider manhole covers". I was quite sharp.
It took them back a bit, but companies forget that this is an interview, ie. you aquire a view of them as they aquire a view of you. My view of them was influenced by that question - it showed they were a fad-based set of idiots, and immediately that question was asked I no longer had any interest in working there.
I didn't get the job of course. The feedback I got was "he was technically fine, but I don't think he took the interview seriously....". Naah. Really? Can't think why.
Cheers,
Ian
The correct answer for this is "flip a coin", this guarantee's you a 50-50 chance of winning.
(the logic give in the parent mail is incorrect, if Monty hall is not biased, the odds are 66% if you switch. Write a program...)
The canonical answer 'switch' is not best because it does not take into account the intentions of Monty Hall. If Monty wants you to lose (and he knows where the goats are), he will give you a second chance in only the cases that you picked correctly the first time. Of course, if he wants you to win (for ratings and ads we presume), he will give you a second chance only if you didnt pick correctly the first time. Given a total lack of information on Monty's information and intentions, you do best to go with a coin flip.
'The thing that drives me nuts is not having the "right" answer to check my answers against.'
The point is there is no *single* right answer, sometimes there multiple good answers, sometimes there are none. The point of the question is to examine the candidates problem solving ability, the ability to think under pressure and produce new answers and sometime the ability to be honest and say I don't know the correct answer. Sometimes the test is will you challenge somebody in obvious authority if they are talking b*ll*cks and can you do it diplomatically. Indeed you answer to this problem indicates [to me] you tend to apply cargo cult type solutions. You want to parachute in the correct answer without understanding why it is the 'correct' answer.
How can that be the correct answer? Fluids from the second woman are going to be on the outside of the condom, so when you flip it for the third, you now have the second's fluids "inside" the condom. That will work to keep her from getting pregnant, but doesn't do a damn against STDs. I hope some of you guys weren't actually using this method thinking it would work.
The world moves for love. It kneels before it in awe.
Could Jesus Microwave a Burrito so HOT That Even HE Couldn't eat it?
Umm, also because the round shape allows for the largest possible object to be fitted through at any orientation for the given surface area.
Say you have a fat workman who represents the maximum size person you require to be fitted down a manhole. Measuring his body in cross-sections you find that the largest diameter across his body is 75cm. A circular manhole that has a diameter of 76cm (giving him a little extra room) has a smaller surface area than a square with sides measuring 76cm. The smaller the surface area, the cheaper the manhole!
Sound right??
A little planning goes a long way...
>Any other prior art that others can remember from the ancient days???
The Sphinx.
'nuff said.
Nouvelles de jeux et technologies en français. TC
I got the job but only because a friend (this guy's peer) wanted to hire me. And, last time I checked, the guy who asked the question was still looking for work.
One of my favorites to ask people is questions about languages they don't know. Stresses the concepts over the syntax. For instance, "You know OO programming, right? ok, Smalltalk is an OO language. Tell me a little bit about what it probably has." My favorite answer was from the college kid who had written Prolog on his resume because one of his courses did a week on it. I asked him to describe the language, and he couldn't, so I described it for him. Then I asked him to think about what uses the language might have, what applications it would be good for. He said, "none, I guess."
www.HearMySoulSpeak.com
Actually, you're wrong. It's really counter intuitive, and people take forever to be convinced, but you should switch (assuming this is your only chance, Monty is unbiased etc.).
Monty opening the door and revealing a goat tells you nothing. You already know that there's a goat behind one of those doors.
Here's a better example. Imagine a pack of cards. Monty asks you to choose which card is the Ace of Spades. You choose one at random. Now, Monty asks whether you'd like to stick, or change your decision to whether the Ace of Spades lies in the other 51 cards. Once you have made the decision, Monty then throws away 50 cards from the pile which aren't the Ace of Spades. Have the probabilities changed? Not at all. You'd still go with choosing the larger pile.
Henry
i don't do sigs. oops.
What do you do when all three numbers are zero?
Of course, the real way to do this is to build the triple redundancy into your memory unit, hardwire the logic (probably using one triple-input nand gate and three two-input nand gates for each bit) and not have the cpu deal with this at all.
turn switch 1 on for 5 mins...turn it off...turn switch 2 on...go into the room...the lighbulb that is on is switch 2, the lightbulb that is off & warm is switch 1...the lightbulb that is off & not warm is switch 3...
"Facts are meaningless. You could use facts to prove anything that's even remotely true." - Homer Simpson
So, how come the solution is Yellow, Yellow, Yellow, Light Blue (left to right) ???
And the people shall be oppressed, every one by another, and every one by his neighbour Isaiah 3:5
The guy freaked. He started complaining that it was unfair and things like that. The funny part was I wasn't judging based on what answer he gave, but how he answered the question. He could have done well, by just rambling about the tradeoffs between different answers. Hell, he could have picked any answer and still got the job, but to lose it over a single question. That was unacceptable.
Where I work, things are often unfair. You can't freak out about it, or you're lost. He was the only person we interviewed for the job. We didn't hire anyone.
'SBEMAIL!' is better than a goat!!
I think the problem here, though, is that state changes will occur that not everyone sees, so their count will be off, and you run the risk of never getting out.
Imagine you're picked for the first time on the 51st day. The light is off. How many people have been picked before you? You have no idea.
(Well, you know at least two people have been picked, but perhaps the warden's been alternating between those two for the past 50 days. But on the other hand, 50 people could have been out. If so, and you started your state-change count at two now, you'd never reach 100.)
Without some accurate way of counting, no one can be sure they've seen all the state changes, and so no one can say with positivity that all 100 people have been out. You end up with a prison full of people with inaccurate counts waiting to reach a number that never comes. Right?
He who refuses to do arithmetic is doomed to talk nonsense.
Favorite technical interview question I've ever heard:
So you're working on a program using the foobarlib library and calling its function baz(), which according to the documentation returns an integer from 1 to 10 that means something or other. Suddenly, you discover that your program is blowing up because baz() is apparently returning -17. What do you do?
The ultimate correct answer that this person was looking for is that you ask your colleagues for help. These days, of course, you also get credit for first searching the web and newsgroups relevant to the package. Surprisingly, many people give up after suggesting things ("Well, first I have my debugger trace everything very carefully to make sure that baz is really doing this, then I re-read the foobarlib documentation") and being told "Ok, you try that, and it doesn't work."
Some people have actually told the interviewer flat-out that "that would never happen; it's impossible". However, those people have usually already demonstrated their unsuitability in other ways.
I interviewed people for a DTP post that required people with knowledge of Quark Xpress and proofreading ability.
About 70% of the applicants got the name of the package wrong on their CV ('express').
A pizza of radius z and thickness a has a volume of pi z z a
Your odds have improved to 50/50 from 33/67. i.e. your first choice is probably wrong. so you're better off switching.
Actually, the Mail is correct.
By switching, you are GUARANTEEING odds of 50/50. By not switching, your odds are still 33/67
If you don't beleive me, write a program to simulate it... Proof of the pudding....
This is an old Mensa puzzle and was discussed endlessly in the noew defunct Mensa forum on Compuserve
And the people shall be oppressed, every one by another, and every one by his neighbour Isaiah 3:5
There are three vending machines. One dispenses only Cokes, one dispenses only Pepsis, and one dispenses either Cokes or Pepsis at random. Someone rearranges the labels on the machines so that none of the machines are labeled correctly. Given that you have no prior knowledge of which machine is which and no way to open the machines, how many drinks will you have to buy to determine which machine is which?
To many, total abstinence is easier than perfect moderation. -- St. Augustine
Anyway, during my Microsoft interview when I was an undergrad, they asked me the following question, which I got "wrong"
You have a 7kg bar of gold (assumed rectangular). Your employee gets paid 1kg of gold a day for seven days (because apparently Microsoft people don't get the weekend off). What is the minimal number of cuts to make such that you can pay him 1kg every day?
I came up with some creative solutions, such as:
- Cutting in 3/4 section, stacking the sections, and recutting, so one cut breaks two pieces.
- Cutting a cosine wave into the bar which just brushed the edges with period 7.
- A whole bunch of other ideas, all of which were "wrong".
Anyway, after much back and forth, he basically hinted away that the answer he wanted was to cut the bar into sections of 1kg, 2kg, and 4kg. Then you give him 1kg the first day, then on the second day, give him the 2kg and ask for the 1kg back, etc etc. (ie binary arithmetic basically)Personally, this seemed like the stupidest answer ever to me, in that you were making the assumption that your employee would a) not spend any of the gold you gave him and b) bring it back to work with him the next day.
Long story short, I didn't get the job, but I think that it shows that people are too fixated on what they think is the "right" answer to something like this, when in reality, there are other solutions.
I could also add some good natured Microsoft bashing about how they make stupid assumption like this in code, but then you wouldn't have anything to reply with
But seriously, I have no problem with these riddles in interviews, as long as they're used properly. The point of asking the question should not be to get a "correct" answer. It should be to see how people react under pressure, how creative and resourceful they are, and how flexible they can be in the presence of (possibly) incomplete information.
Even someone who gets one of these answers "wrong" (perhaps because they overlooked some obscure point) would score points in my book if they could explain somewhat sound reasoning behind it and not get flustered while doing it.
The best interviews I've had were right out of college, when the interviewer asked me about one of my grad school projects, then told me to explain it on a whiteboard, on the spot. Those were also the places I thought I'd most like to work at!
There's excellent explanations of why it's correct to switch here and here
And the people shall be oppressed, every one by another, and every one by his neighbour Isaiah 3:5
from the site...
How many prisoners found their doors open after 100 rounds? The answer of course, is none - after the first drunken round, the prisoners have awoken, left their cells, and are busy drinking at the nearest strip club.
I really hate signatures, but go to my website.
> How much wood could a woodchuck chuck if a woodchuck could chuck wood?
:-)
9 cords.
(Apologies to Monkey Island 2
I've never answered a riddle question correctly in an interview. I just act like such a blatant smart ass that the interviewer gets frustrated and or impressed with my attention to detail. In this way I have probably lost job opportunities, but you know what, I don't give a fuck. I didn't go to college and major in engineering, a major lacking any female contact, so that I could graduate and be asked to solve riddles. If an interviewer is going to waste my time by asking me stupid questions rather than asking about past real problems I've had to solve, projects, and accomplishments at other jobs, then they'd better be prepared for a barrage of equally stupid questions/remarks.
~ now you know
Alive without breath,
As cold as death;
Never thirsty, ever drinking,
All in mail never clinking.
--
"Outlook not so good." That magic 8-ball knows everything! I'll ask about Exchange Server next.
Manhole covers are round because manholes are round. Manholes are round because the tube shape naturally resists the crushing pressure of the ground surrounding it.
It is for this reason that very old water wells (like in Africa and southern Asia) are round. The rocks you form the walls with resist compression quite well (pun unintended), and you get a sturdy, low-maintenance water source.
Most of the old wells I've seen have rectangular covers, but the ones that people walk over have round covers so that the edge sits flush with the surrounding ground. Most of the flush-mounted ones are in built-up cities (like old London), and I imagine that the local barrel maker manufactured those as well. The edge of these is a row of stone/cobble that's set deeper into the ground than the surrounding cobblestone street.
I think the modern answer (of geometry and axes) is quite boring, and ignores history and tradition too much.
------ Exercise Instructions
Dear Candidate,
This exercise is intended to break the monotony of the standard interview questions like "Tell me about your strengths and weaknesses." Please read this document thoroughly before you start!
Your instructions are simple: Build something using the Lego Mindstorms Robotics Invention System and then tell us about your experience!
There are no constraints on the simplicity or complexity of your project though you are expected to do programming as well as mechanical assembly. You are free to use the examples in the kit or the provided documentation (O'Reilly Mindstorms book) as a starting point.
System Setup
The computer has the Lego Mindstorms software loaded and tested.
The firmware has been loaded into the RCX module and tested. COMM 1 is working for the IR Module connection. Batteries should be good (let us know if you have system problems - they are not part of the exercise!).
In addition, on the computer is an additional programming system called RCX Command Center (Version 3.1) that uses NQC (Not Quite C) and a graphical interface for programming. This has also been tested and documentation is provided. You are free to use either the Lego software or RCX Command Center for programming your robot. The CD-Rom case has instructions on how to bypass the Lego Tutorial.
Presentation
At the end of the exercise you will give a presentation and demonstration (5 -10 minutes) of your project. Feel free to use the whiteboard and/or flipcharts for your presentation if needed. Please address the following topics in your presentation:
How did you set about the exercise in terms of planning, architecture, and construction?
What did you intend your robot to do and what does it really do? Why?
What obstacles did you encounter during construction? How did you overcome or bypass them?
What would you do different if you were given another session?
There is no "right answer" to this exercise and there are no hidden tricks or traps. The intent is to give you an opportunity to show your creativity, learning skills, problem solving, time management, and explanation skills in a different way.
Please have FUN!
"I say we take off, nuke the site from orbit. It's the only way to be sure."
Try sneezing. It's like an orgasm without the sex. ;-)
(Or the dinner & movie, or the having to call afterward, or the child support...)
Lately democracy seems to be based on the skybox, the Happy Meal box, the X-box, and the idiot box.
Guess I won't be interviewing candidates at Microsoft!
I interviewed people for a DTP post that required people with knowledge of Quark Xpress and proofreading ability.
About 70% of the applicants got the name of the package wrong on their CV ('express').
Err, the package is called QuarkXPress, not Quark Xpress, QuarkXpress or any other derivative. One word, only one 'e' and with the 'q', 'x' and 'p' capitalised.
By the way, do you know how to spell irony? I bet you do...
"Accept that some days you are the pigeon, and some days you are the statue." - David Brent, Wernham Hogg
One of interview methods that makes the most sense to me is described in the The Guerrilla Guide to Interviewing.
Interviews should determine two things: whether a person can do the job, and whether they will do the job. Riddles don't really figure into either of those.
--Bruce
There are 10 kinds of people in the world: those who understand binary, and those who don't.
Admittedly, I'm not very good at math, but here's what I've come up with...
If I remember my geometry correctly area of a square is (base x height) and a triangle is (base x height / 2)
Big Triangle: 5x9.5cm Area: 23.75
Small Triangle: 7x3.5cm Area: 12.25
Dual Triangle: 5x9.5 and 2x5 Area: 28.75
Square: 3x3 Area: 9
Square Triangle: 5x4.5 and 2x4.5 Area: 27
Total Area: 100.75cm
Sqrt: Approx: 10cm
Am I right so far?
I'm still not getting it.
The man who trades freedom for security does not deserve nor will he ever receive either. - Benjamin Franklin
I dig the challenge of riddles. Far worse are the syntax quizzes! Knowing about semicolons after function declarations or 'else' is the compiler's job and not a strong indicator of creativity or capability in a programmer.
The riddle:
"U2" has a concert that starts in 17 minutes and they must all cross a bridge to get there. All four men begin on the same side of the bridge. You must help them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one time. Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must be walked back and forth, it cannot be thrown, etc. Each band member walks at a different speed. A pair must walk together at the rate of the slower man's pace:
* Bono: - 1 minute to cross
* Edge: - 2 minutes to cross
* Adam: - 5 minutes to cross
* Larry: - 10 minutes to cross
For example: if Bono and Larry walk across first, 10 minutes have elapsed when they get to the other side of the bridge. If Larry then returns with the flashlight, a total of 20 minutes have passed and you have failed the mission.
---
Another:
You are given 10 baskets. 9 of the baskets each have 10 balls weighing 10kg per ball, however one basket has 10 balls weiging 9kg each. All the balls and baskets are identical in appearance. You are asked to determine which basket contains the 9kg balls. You have a suitable scale, but may only take a single measurement. No other measurements may be taken (like trying to determine by hand). You may remove balls from the baskets but may still only take one measurement. How do you do it?
Big Daddy, Johnny, Burp, Aunt Zelda, Scott, Slurp, Big Momma
I have put up my own little riddles page. Time for a little slashdotting... ;)
Make even shorter URLs - 8LN.org
000 0
001 0
010 0
011 1
100 0
101 1
110 1
111 1
(a & b) | (a & c) | (b & c ) | ((a & b) & c))
Karnaugh Mapping...
'a'b 'a b a'b a b
c _ x x x
'c _ _ _ x
so the simplifications that can be made....
(c & (a | b) ) | (a & b)
there are no other 'little circles' that can be made on the map (as my EE101 prof was so fond of saying) therefore there are no further simplifications.
--Ks9
Chris Beckenbach
But what if the object you need to fit down the manhole is not round? Say a normal skinny persona is asked to get a stove down the hole. (Why is byond the scope of this discussion) Stoves are big, and square. So the ideal shape would be a square hole just biiger then the stove, so it can be lowered into the hole. Nobody in their right mind would carry a stove down the ladder, so they would have to get a tripod to lower it, therefore they just need enough room for the stove to fit, with straps on.
I would call it "the Bingo solution"...
- You are asuming that everyone has paper and pencil (or similar instruments).
- They have to be careful (not to loose the count of the days so that incorrect info is transmited)
- If the prisoners were taken at a regular pattern, they would never go out, but the text says "Everyday, the warden picks a prisoner at random" so there in no regular pattern.
The first days:
In average, in the first 100 days one should be picked in his own day, so himself and the next one who visits the room know that he has been there. Both can tell about it if they are chosen in that day.
The last dyas:
Probably, the last days before freedom many of them have their "bingo cards" almost complete and they are waiting for the last to be chosen to visit the room in his own day.
--
ACid
This is the elegant solution I was looking for. I started trying something like this but didn't get it quite worked out, so I tried another tack. I'm glad you figured it out.
The only weird sort of problem with this solution is that if you are picked in order every day, you'll never leave. In fact, there are many orders in which numbers can be essentially "segregated" from each other, so that no one ever knows that everyone has already been picked.
But if distribution really is random, then this is definitely the best strategy. It'll certainly be quicker than my Master Counter way. Thanks!
He who refuses to do arithmetic is doomed to talk nonsense.
They're being held in solitary confinement. There's no reason to assume they can all see the bulb every day. The Prisoner's and the Lightbulb is discussed more here.
He who refuses to do arithmetic is doomed to talk nonsense.
43 days 8 hours 25 minutes
They spend 24 days forming a union, demanding equal rights for black and migrant workers, spend another 4 days deciding what kind of bricks they should make the wall out of. 23 more days are spent trying to determine which company should provide the bricks for the wall, then they all rest for 8 hours (lunch break, you understand) and finish the actual construction of the wall in 25 minutes.
Just like any gov't project.
Whoever stated that signature sizes should be limited to one hundred and twenty characters can just go ahead and kiss my
Always carry at least three condoms with you at all times, in case you a cornered by a group of women who demand immediate safe sex.
Jeez, folks, stop hiring such morons who can only answer trivia questions. All interviewees are worthless unless they can pass the Final Exam.
I can explanate how to administrate your network. You must configurate and segmentate it, so it can computate.
Let's call the mother's age M and the child's age C (in years).
:)
We know that:
M = C + 21
and
M + 6 = (C + 6) * 5
So solving the system we get:
M + 6 = 5C + 30
21 + C + 6 = 5C + 30
C + 27 = 5C + 30
C - 5C = 30 - 27
-4C = 3
C = -3/4
1/4 of a year is 3 months. 3/4 is 9 months. If the child is -9 months old, that means he or she will be born in 9 months, so has just been conceived.
The father isn't necessarily on top of the mother (fertilisation can happen up to 2 days after sex), but he's probably still around.
He may be trying to hold up his pants while running from her father.
Actually there would be another possible "smart" answer if the mother was a few years younger: the father is probably in jail.
RMN
~~~