Languages
Social Media
Feeds
Powered by Squarespace
Social

« Review - Windows 8 | Main | Saving extra-network bandwidth with an Apt Cache »
Tuesday
Jul102012

Enough with the puzzle questions already.

So I did an in-person interview today, and while it could have gone worse it could have gone one hell of a lot better as well.  I will first admit that some, if not most, of my problems had a lot to do with my recent hiatus from PHP, which the job was for.  However, I think much of it had to do with the fact that the programming questions I was asked to do today had nothing to do with anything I'd ned to do in my day job nor anything I've ever had to do.  Why do we ask back-end web developers how to impliment a bubble sort? The correct answer is NOT anything like

function BubbleSort(&$data, $key)
{
    for ($i = count($data) - 1; $i >= 0; $i--)
    {
      $swapped = false;
      for ($j = 0; $j < $i; $j++)
      {
           if ($data[$j]->$key > $data[$j + 1]->$key)
           { 
                $tmp = $data[$j];
                $data[$j] = $data[$j + 1];        
                $data[$j + 1] = $tmp;
                $swapped = true;
           }
      }
      if (!$swapped) return;
    }
}

&npsb;

The correct answer is, and should always be:

sort($array);

Sure, it isn't a bubble sort its a more efficient alogrithm but it happens to be the right answer. NEVER NEVER NEVER write something complex when you can use the tools provided by the language.

At another recent interview I was asked to impliment something similar to SHA1...  The correct answer for this one is;

sha1($message);

When you ask these sorts of questions all you determine is weather or not I can Google for "interview puzzles" and memorize the answers. Do me, your business and the rest of the dev team a HUGE favor and ask me questions that are relevant to the job you want me to do. Ask me about templatizing websites, or how to optimize the SQL queries, or maybe about common bottle necks in websites and how to resolve them.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>