I just screwed up a coding test!

I’m sitting here beating myself up. I started writing this 3 minutes after sending this email to my recruiter at Amazon:

Please find attached my attempt at this exercise. I do not believe I have successfully fulfilled the requirements, and in fact I’m throwing a null pointer exception, but as I have run out of time, I’m turning it in anyway.

If there’s one part of the interview process I’ve never worried about, it’s the take-home coding test. Generally they ask me to write FizzBuzz or something, and that’s easy enough. Dropbox gave me a cool little array-traversal that took very little time, once I saw the trick. Axiom asked very easy questions, since I was a student, and didn’t bother with the take-home coding test since I was local. When I moved internally to the engineering division of Janus, the phone screen involved swapping the color of an image stored as a byte array. The in-person interviewers broke out FizzBuzz and the bar raiser broke out Dropbox’s problem again (didn’t get it that time, oddly enough).

If I’m sitting in my old accustomed chair in my home office, typing on my machine and using my IDE, there are no problems I could be reasonably asked to solve on this time scale which escape the mighty reach of my intellect. Nobody’s giving out hard-core domain-specific take-home tasks which require special knowledge of undocumented libraries. You’re looking at standard libraries, familiar languages, and choice of tools. It’s nice.


In past cases, either the problem’s simplicity made  it very doable or the time scale was generous enough to let me muddle through and wait for the flash of insight. This time, the time scale was an hour, and I spent the first half of it trying to generalize one of my old data structures from the blog while switching the language in which it was written. Don’t do that, guys.

I shouldn’t tell you what the data structure was, since the PDF of the assignment has a big bold ‘CONFIDENTIAL’ footer on it. It’s a generalization of one I’m familiar with, though, both in the structure of the nodes themselves and in the relationships between those nodes. I spent so much time trying to work through the data structure and the algorithm that I ran out of time on the client code to test it, and my submission has a null pointer exception. To say that it’s a little embarrassing would be an understatement.

So, what’s the lesson here?

  1. I need to study more. The comfortable baby data structures I’ve been playing with aren’t going to cut it. I could’ve given ’em a hash table, sure. They didn’t want a hash table.
  2. I need to study more. Data structures are great and all, but I need algorithms – I kinda half-assed a breadth-first search, but I’m not sure my recursion step actually made any sense. The generalization of the structure isn’t to blame, here – I couldn’t figure out how to store the restrictions of the structure’s definition across the steps of the recursion.
  3. I need to study more.