izard: (Default)
izard ([personal profile] izard) wrote2018-08-08 02:08 pm

Puzzles, interivews

Now every technical interview involves a whiteboard/computer coding/solving of simple/medium level puzzles. As any sport, one needs recent practice to perform well. I did not practice in that since 1998, and I only had one such interview in ~2010 with google, where I failed.

I don't argue that it is not a worst proxy for evaluating programmer's job performance (in the same way as running speed/stamina is a proxy for evaluating football player skills).

I decided to spend some time to understand my current status and improve it a little bit. So I selected a random puzzle from hackerrank with medium rating and low average pass count.

It took me about 3 hours in total to come up with a correct O square algorithm, and one hour to implement.

This Clojure implementation by the way is probably not O square as it times out on bigger tests. So I need either to profile it and fix, or re-write in C where reasoning about execution time is trivial.

So if I got this puzzle at a Google/Facebook/whatever interview, I would have failed, as one needs to solve this in 30 minutes, not 4 hours. And when I encounter puzzles of similar complexity at work (not very frequently, maybe once every couple of months), solving it in 4 hours is never an issue.

Upd:
For two people, who are much brighter than me, it took several minutes to find the algorithm which is O(n) and describe in the comments. I implemented it (took me half an hour), and now it passes all hackerrank tests: