garote: (Default)
garote ([personal profile] garote) wrote2017-10-25 11:08 pm
Entry tags:

Code exams

I recently stepped from one job into another. On Friday I was working for the Berkeley labs, then on Monday I was working for a startup company across the street. From my new office, I can look out the window and see the sunlit hallway in the old building, where I used to take snack breaks. My bicycle commute is exactly the same. Nice!

The old job was being cut due to lack of funding. I was going to spend a while "funemployed" after that, but with a couple weeks to go I changed my mind and hit the job market. During those few days I brushed up my interview skills. This drove me a bit bonkers.

There are a zillion companies now that claim to be able to train you for an interview -- or interview your candidate for you, with multiple-choice quizzes and in-browser code tests. These vary in quality and content, more than you can imagine. The worst of them are crowd-sourced, going for quantity so they can boast "thousands of questions" on their press material. All the questions - multiple choice, fill in the blank, whatever - are weird nit-picky crap. All of them. The ones that aren't are so few that they're within the margin of error in the measurement and don't matter.

I took a quiz on Bootstrap and the first question was:

"Which of the following classes are generated on a blue button in the UI: btn-blue, button, ui-btn, blue?"

Are you fucking kidding me? Is that knowledge absolutely essential in sorting out n00bs from rock stars?

"Does Javascript's getDay() function return the weekday starting from 0 or from 1? Does the lowest value represent Sunday, or Monday?"

Oh wow, yeah, I need to look that up at least twice a day. I should have it memorized.

"What's the default duration of a jQuery.fadeOut() call?"

Answer: Fuck you.

Then there are the sites where you actually write code. They are better, but they have their own problems. Sometimes the answer they expect is very, very specific, and if you don't follow their formatting, or put commands in the same arbitrary order, you lose. Eventually I settled on the Codility website, which didn't suck. I barreled my way through ten of their tests, picking them at random, switching between Python and Javascript. Felt pretty good! Then I hit a problem about calculating "semi-prime" numbers.

Find the number of semiprime numbers (numbers that are the product of two primes) within the range (P, Q), where 1 ≤ P ≤ Q ≤ 50000. Your program must have a worst-case run time of O(N*log(log(N))+M) or better.

There is exactly one way to solve this, and it means implementing a modified version of an algorithm called the “Sieve of Eratosthenes”. Go read about it; I'm sure you've never heard of it.

This problem is dropped in with a bunch of others about sorting arrays, walking trees, and munging lists. Guess how often the Sieve of Eratosthe-butt-ass has come up in thirty years of a very respectable programming career?  That’s right. Not once. But you either know it, or you don't. Or you're Nicomachus of Gerasa from the year 60, and you come up with it on the spot.

You know what this is? This is like qualifying a construction worker to operate heavy machinery by testing his skills with the drop-claw game at the pizza parlor.

Anyway, I quit after that. I'd gone far enough. Any interview that would ask me about the Sieve of Erazzo-poof-shart is an interview I'd be happy to flunk.

juan_gandhi: (Default)

[personal profile] juan_gandhi 2017-11-09 03:39 pm (UTC)(link)
Modified a-fortiori; have to think about it. Interesting. Pretty close to my mentality. How do we do Fibonacci? By multiplying matrices, because it's cool!