I failed to reverse a linked list

A couple of weeks back, I noticed the ad for the Silicon Alley Talent Fair on Stackoverflow.com. Given that I was going to be just across the river from Manhattan this weekend, I figured I would stop by, check out the event and some of the companies I had not heard of before, and drop off some resumes just in case.

First off, let me point out that the event was well organized. I arrived about an hour after the doors had been opened, and noticed that there might have been a line out the door at some point, but my processing went smoothly. My only major complaint is the fact that the organizers used i.e. pretty much everywhere they meant e.g. and listed personal hygiene as the first thing to bring. I am a firm believer in the fact that that sort of thing should not need to be explicitly mentioned, but then, what do I know?

Inside, I got a chance to find out more about some of the companies whose web sites I had checked out before (and some companies whose Career links 404’ed on my phone ;-).

At one point, I got lured to the ZocDoc stand for what I was told was a “fun computer science quiz”. I am an economist by training, and a self-taught programmer, so I find these kinds of things to be fun tests of whether I can think on my feet. So, I signed up.

Half an hour later, the thingamajiggie they gave me starts flashing, I run over to their booth, I am met with an interviewer, and he wants me to write C code to reverse a linked list in place on a 3x5 piece of paper. Panic sets in. Not panic that I don’t know this, but panic that in the middle of all the commotion and noise and distractions, I won’t be thinking clearly. A little sketch clarifies that you need three pointers to keep track of what you are doing.

[ el1 ] → [ el2 ] → [ el3 ] → …

needs to be turned in to:

[ el1 ] ← [ el2 ] ← [ el3 ] ← …

We agree that’s the right way to do it, but I just cannot write the loop condition. My hand writing is horrible and large and I can’t fit anything on this little sheet. My *s look like blobs. I run out of my five minutes, there are other people waiting etc, so I decide not to waste more of their time. The interviewer takes my resume that was in a pile of other papers, scribbles some stuff on it and I am left with the sinking feeling of arrggghh! Why did I volunteer for this?!

In my defense, I had thought it was going to be a fun computer science quiz.

In the scheme of things, this was not as bad as not being able to solve FizzBuzz, but now I understand how those people feel.

And, while ZocDoc provides a cool, new, and exciting service, I was not even interested in working with them.