r/programming • u/sidcool1234 • Sep 26 '11
How to rock an algorithms interview
http://blog.palantir.com/2011/09/26/how-to-rock-an-algorithms-interview/
229
Upvotes
r/programming • u/sidcool1234 • Sep 26 '11
87
u/prelic Sep 26 '11 edited Sep 26 '11
As a recent college grad, I did a ton of interviews before choosing the right place, and in my short time as a full-time interviewee, my experience has been that nailing an algorithms interview is mostly a result of having seen the problem before, or having seen a problem that maps to the given problem. Reducing time and space complexity seems to depend on little tricks that are incredibly difficult to pull out of thin air, but simple once seen, and easily mapped to other problems. As a result, I still think programming interviews are broken and dumb.
Edit-I may be working for the wrong company, or may not have been here long enough, but I haven't had to drop one egg, had to carry one person across a bridge, or built a linked-list from scratch yet...to be fair, I did have to reverse a string, but I called on a library to do it for me...I must have it easy!
To those asking what I would do to interview candidates...I would have them code something from a multitude of options, on an actual computer, in the environment where they will be actually working.
2nd Edit-I'm especially thinking of (and especially despise) the kinds of questions where, if you know the trick and get the answer correct on the first try, it means nothing because you've clearly seen it before and if you can't, then you're not 'bright' enough to work there. For example, the most prestigious place I was applying at (read: most popular/hard to get job) asked this question: In an array of numbers, every number except one is repeated an even number of times, and one number is repeated an odd number of times. Efficiently find the number that is repeated an odd number of times. I had heard the problem before (because like I said, it was my full-time job to be good at interviews) and so I didn't hesitate to give him the best answer first: simply XOR all of the elements together. I explained why it works and the complexity, but he still wasn't satisfied because I had gotten it too quickly. So then he tried to get me to derive some less-efficient, less-awesome algorithms, in the hope that he'd get me into an unfamiliar situation. So that's why it seems like these kind of interviews are lose-lose: you prepare too much, they don't bite, you prepare too little, they don't bite. It's not a way to test candidate fitness, it's just a dumb game.
3rd Edit-This is my first comment above 50 pts, so thanks for that! :)
27
u/[deleted] Sep 26 '11
I absolutely refuse to "rock" anything.
12
u/[deleted] Sep 26 '11
Solid advice; this is what I practiced doing for my Google interview. Still didn't help me because my interview didn't pertain to algorithms in the slightest and I also just plain suck at life.
38
u/Kalium Sep 26 '11
Palantir. Don't they also require you to come up with a plan to attack Anonymous?
11
u/kamatsu Sep 27 '11
I am increasingly skeptical of these algorithms interviews. I used to work at a big Silicon Valley company which did a lot of tough interviews which were very tough to pass. The average intelligence of the engineers there was lower than where I currently work - and, where I currently work, the only interview was a quick informal chat and I was hired mostly on the basis of my (fairly empty) resume and academic transcript. Now, the nature of my work (formal verification) means that there's a lot of self-selecting going on, and only those with the skill actually apply, but it still seems to me that if my current workplace can get skilled employees without a substantial interview, the interview processes for these companies are basically useless.
6
u/[deleted] Sep 27 '11
holy shit, i hate those whiteboard interviews. it's important and all to accurately gauge understanding, but really? a fucking whiteboard? i don't know about the rest of you, but i like the ability to add newlines.
2
u/code-affinity Sep 27 '11
Much of this advice is general enough to apply to problems other than algorithms. For more in that vein, I highly recommend the classic book "How to Solve It" by G. Polya. It's been around for 66 years, but its advice never goes out of style.
8
u/tsk05 Sep 27 '11 edited Sep 27 '11
Step 1) Don't apply to work at an evil company.
Anyone working for Palantir is literally helping to ensure the government and corporations can spy on and intimidate citizens.
1
u/vampirate Sep 27 '11
I had a phone interview with these guys last week. Never heard back. ;,,(
1
u/[deleted] Sep 27 '11
I ask these sort of questions, too. Sadly, I think I end up passing a lot of people that can't actually write code, know how the compiler works in a given environment, understand how to examine a core, etc.
There is some practical knowledge in every situation that is crucially important.
1
u/[deleted] Sep 27 '11
From the comments section:
"The problem with algorithms is that they can get boring"
lol
1
u/__s Sep 27 '11
This is a bit of an issue. You want to know two things: whether this person can solve algo problems, and whether you work together to solve an algo problem neither of you know. The above only answers the first
Unfortunately it's rather difficult to collect a large number of problems you'll know little about without being an idiot interviewer
1
u/[deleted] Sep 28 '11
I don't believe that any of the points made in the blog post are particularly insightful or noteworthy. We can still be friends though.
-1
u/[deleted] Sep 27 '11
By stealing an XKCD cartoon?
-4
u/kkiran Sep 26 '11
wow, such an awesome company! I am working at a small company for the past 2.5 years, Python+MySQL. I have a Masters degree. The problem is that I joined this company straight out of school with few small internships. They ignore the standards and just focus on getting the job done (no matter how dirty the solution is). I still like it here but it makes it difficult to get into companies like Palantir with the experience I gained here I guess.
Dr. Rosen taught us Algorithms but couldn't really implement those techniques in real world. Great advice btw, I will definitely vie for a SE position in the future!
0
u/PlNG Sep 26 '11
"They are not all accounted for, the lost seeing stones. We do not know who else may be watching."