93 points · by pramodbiligiri · 5y ago · 56 comments
The best online programming puzzles were the ones ITA Software posted to entice people to apply for jobs there.
What was effective about them was that, reading the problem, you wanted to know what a solution would look like, and knew the only way to know was to solve it. Having solved it, you wanted to know how your solution compared to others'. The only way to find out was to send it in. Having sent it, you might get an invitation to visit, and then how could you not?
After Google bought ITA, the puzzles were up for a while longer, then seemed to vanish. If they are archived somewhere, I would like to know where.
> Roll Your Own Chat Server
> Implement a simple standalone TCP-based chat server, using the following protocol:
> ...
> When implementing the server, aim for scalability and robustness. (Many submissions fail due to lack of robustness!)
> ...
> Please do not use an existing networking framework
Oh man. You weren't kidding, that's high-precision nerd-sniping.What I sent in was the Add-a-gram (on that page, stashed behind the "Puzzle Archive" link). I sent one solution, and when they called, they admitted others were faster, so I redid it that evening ten times faster and sent that. What they never told me, even after I had been there for years, was that my second solution was faster than theirs or any others they had on file. It looks like they retired it right after I started there, maybe because I had shown it didn't actually require backtracking, which they were trying to filter for–ITA was mostly a Lisp shop, so they wanted people who would always reach for recursion first. My solutions were relentlessly iterative.
Some years after I left ITA, they posted the Bitvectors puzzle, which I had to solve, in a fever, but never sent off. (At the time I think it had a different name.) That solution also didn't require backtracking.
Nope, Linux reports it as readable/writeable but not having exceptional condition, while Windows reports it as only having exceptional condition pending but not as readable nor writeable. Beautiful, just beautiful. In the end you have to put sockets in such scenarios into all three sets and check what getsockopt(s, SOL_SOCKET, SO_ERROR) returns for them, that's the portable way.
Undergraduates solve it in two minutes; people with a BS need 5; MS 20; PhD never, or as fast as an undergraduate. The iterative solution is much simpler than a recursive one, so the question identifies how well-tuned your instincts are to problem spaces. If you go straight for recursion, you'll be there all day.
I found that everybody who found the minimal solution used the same hand gesture while describing it.
I always recited the statistics at the outset, so that the interviewee would know how much complexity to expect in the answer. It never seemed to help them.
Now that we have AI to solve "LC type of questions", can we stop asking candidates to invert a linked list in an interview.