by dkarl · 16y ago · 0 comments
Choosing C would be a pretty big fail, though honestly, people didn't struggle much with language issues. I told them it was fine if they didn't remember exact APIs, and nobody got to the point where they were worried about whether the code would parse. One guy did it in C++ using the string class, and I don't think he was at a big disadvantage. It's (evidently) harder to figure out the details of the algorithm than to write out a solution in C++.
Did any of the candidates use Python or ML or Haskell? What is the reason they didn't get it right?
It may be harder to figure out idea of the algorithm than the implementation details, but in my experience you often won't even think about the high level algorithm if you are in a C++ mindset, you'll only think about swapping letters around.
Actually conceiving of the solution was the roadblock for most, but the ones who got past that struggled to figure out the recursion -- what should be the signature of the recursive function?
Pipe the result through "sort -u" if you don't want dups.