Enough with the puzzle questions already.
Tuesday, July 10, 2012 at 4:12PM 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.
Arron |
Post a Comment | 

Reader Comments