by supercoder · 13y ago · 0 comments
Though I wonder what the intent is here, say for the first question - "What is the pattern here ?"
After looking up the solution on wikipedia - http://en.wikipedia.org/wiki/Look-and-say_sequence I would have to admit there is no way I'd figure that out without knowing the concept ahead of time.
So are they looking for someone that knows the 'look and say sequence' explicitly ? Same way if you presented the meaning of numbers 80 or 443 to someone they'd either know or not, but not be able to guess.
Or did they actually expect someone to work it out on the spot ?
This makes it a bit different from other problems, where the interviewer is often not even so much interested in the solution, but in how you go about finding one. Many other sequence problems are amenable to a more systematic approach that at least tell them something about your problem-solving techniques.
With the look-and-say sequence, you either see it or you don't. Regardless of whether you got it right or not, it doesn't tell an interviewer much about you, and is therefore not a good use of the limited time they have with you that could be used more productively.
V : 1 2
ω : 1
P : (11 -> 21) (2 -> 12) (1 -> 11)
I think that matches the information given in the question. Would that be an "incorrect answer"?
Your major problem would be finding an interviewer who knows what's an L-System
Edit: you should add the rule 111->31, so it may not be an l-system because there are infinite rules? (1111->41), etc
Or we limit it up to digit 9
That's an issue with any sequence-style problems.
My hope is that they'd hope a candidate would be able to identify the connection to run length encoding within the pattern.
Why do these puzzles emerge at big companies? It looks like a sort of institutional power trip emerges: "if you want to work with us, you need to be real good, and these are the sorts of problems we want you to think we deal with every day!" Except in most cases, they aren't, and there are plenty of mediocre folks already employed there. But the institution NEEDS to believe it only hires the best, and one way to perpetuate that belief is to haze new applicants more and more. All it really produces is candidates who are very lucky, or very compatible with the existing culture.
Hiring is hard, and puzzles are a fail-fast mechanism that is terrible, but produces some sort of results, so it gets used.
In short, if you can't write a simple FizzBuzz program, then you are probably not a good developer. Questions like these are good for being a quick way to separate programmers from those who cannot program at all.
But I agree - as someone who sucks at puzzles under pressure, questions like 'what's next after 111221?' seems like a totally retarded question to me.
I'm not sure if there being multiple "correct" answers makes me like the question or hate it. The Fibonacci sequence seems a bit more obvious though than the "look and say" answer.
I just figured it out on my own, from the comfort of my home, while having breakfast. In an interview with a top notch company that'll be a totally different story.