Some people, when confronted with a problem, think “I know, I’ll use regular expressions!” Now they have two problems.
– Jamie Zawinski

Some people, when confronted with a problem, think “I know, I’ll quote Jamie Zawinski!” Now they have two problems.
– anon

Just to show that I practice what I preach, I headed over to TopCoder a few hours ago to try my hand at some simple TCHS problems. By my surprise, the problem I opened was very similar to one of the technical interview questions in my previous company. I know this because as a technical interviewer, I’ve already given this problem to a couple of potential employees.

Now this isn’t surprising. Basic algorithm-related questions are good filters for weeding out so-called “developers” who never really had much programming practice in college, but there’s only a few types of questions you can ask at this level–go any higher and you’ll likely be stuck with Complicators instead of pragmatic programmers.

Anyway, what struck me with this problem is that it can also be solved with regular expressions. This has never occurred to me before, mainly because I didn’t expect even the top students from the top universities in the Philippines to approach the problem that way. From my experience, I would expect applicants to play around with loops instead.

This made me ask myself the question:

If you were a technical interviewer, how would you rate an applicant who used regular expressions in solving the problem?

I would first look at how much effort was spent in trying to fit in regex to the solution. If the applicant takes too long to figure out the regex, then it’s a classic case of forcing regex on a problem (as mentioned by the first quote). In this case I would mark it against the applicant, especially if it turns out that the applicant could have solved the problem better without regex.

Now, if the applicant was able to use regex with little effort, I’ll proceed to determining why the applicant used regex in the first place. (To come to think of it, I would try to determine this, regardless if the applicant was good at regex or not.)

As I mentioned before, I’m trying to avoid blindly giving passing marks to Complicators. There are many reasons why one can use regular expressions and there are many reasons why one should not; for Complicators, only the former applies. Passing this part would require the applicant to convince me that regex is a good approach to solve the problem and not an unnecessary complexity.

It is only after I finish evaluating those two criteria that I would provide my assessment of the applicant for that problem, and after which we would move on to the next interview question.

Tagged with →  
Share →

One Response to Technical Interviews and Regular Expressions

  1. […] trick questions. The fun part here is that I did that not because I want to boost my ego like many complicated/puzzle questions (secretly) do for the interviewers, but because I specifically wanted to test the applicants’ […]

Leave a Reply

Google+