September, 2008

  • The Old New Thing

    Tales from the interview: Can you rotate this two-dimensional array?

    • 94 Comments

    My colleague jeffdav told me about one job interview with a graduating college senior that didn't go well because the candidate simply gave up.

    He offered a simple programming task: Write a function that takes a 4×4 two-dimensional array and rotates it clockwise by 90 degrees. For example, the entry in the upper left corner of the array goes to the upper right corner.

    The interview candidate simply gave up without even writing so much as a function prototype. "I can't do it."

    — Okay, well, let's take it a step at a time. Maybe take a specific example and see what we can learn from it.

    "It's some sort of matrix multiplication."

    — All right, well how would you start working that out?

    "I don't know. I can't do it."

    That's really not a good way to demonstrate your problem-solving skills: By responding to a problem with a simple "I can't do it." All of us are faced with things we can't do. The important thing is that we are willing to learn what we need in order to be able to do them.

    I wonder if this particular person thought that attitude would fly at a real job. If your boss gives you a difficult job, would you just say, "I can't do it"? Heck, how do you even graduate from college with that attitude? Your professor gives you an assignment, and you just say, "I can't do it"?

    (The punch line for people who actually know matrix algebra: Matrix multiplication doesn't solve the problem anyway.)

    Bonus commentary: I reprint JeffDav's comment which he posted below, since it is after all his story.

    This was a question reserved for intern candidates and fresh out of college hires. I was usually the first one on the loop and used this as a warm-up question. Once they got it, we'd move on to something more interesting. This one guy just refused to believe it was even possible.

    Also, I would phrase it as "rotate an N x N matrix where N >= 1, and you are given N along with the matrix A." This makes it super easy. If you allow an N x M matrix (i.e. non-square) the question gets much harder.

    I don't ask this question as often anymore. I get bored with asking the same questions over and over. Furthermore, I think after about the 100th time you ask a question you have lost perspective on it. Once you can write the answer on the whiteboard by heart without even thinking, you get annoyed by anyone who takes more than a few seconds thinking about it. It may not be a conscious annoyance but it's there if you think about it, and I think it gives you a bit of a negative bias at times. At least it does for me. It's good to find new questions so you have to solve them yourself and you have that feeling of approaching the problem for the first time fresh in your memory.

  • The Old New Thing

    It helps if you write a cover letter and remember the name of your interviewer

    • 2 Comments

    It's not a big thing, but it shows that you have your act together and does a lot towards distinguishing you from everybody else. A story of the importance of writing a cover letter and remembering the name of your interviewer.

    (Then again, what do I know. JobsBlog probably is a better source for this type of info. Earlier this year, Angela McLaughlin shared her thoughts on cover letters.)

  • The Old New Thing

    How do I convert an error code to text when FORMAT_MESSAGE_FROM_SYSTEM doesn't work?

    • 9 Comments

    For the same reason that not all error codes are defined in winerror.h, not all error strings are defined in the system message table. If you've ever played with the message compiler, you'd quickly have recognized the winerror.h file as the header file associated with a message resource. In other words, there's a .mc file that gets processed by the message compiler, and out pops the message resource (which becomes the system message table) and the winerror.h header file.

    As we saw a few years ago, not all error messages live in winerror.h, which means that not all error messages live in the system message table. Each component that provides error codes outside of winerror.h needs to provide its own message table. For example, messages for network errors can be found in netmsg.dll. Similarly, winhttp error message text can be found in winhttp.dll. I don't know about other message ranges; hopefully the documentation for the component that generates those errors also mentions where you can find the text.

Page 4 of 4 (33 items) 1234