Want a Free Job Posting?

Buy a job posting today and the second one is on us. For a limited time only. Act Now.

Interview Question

Interview Fort Collins, CO

Work out an algorithm for printing out the individual

  characters to show the decimal representation of an arbitrary integer.

Interview Answer

1 Answer


Simple, right? Well, it had been many years since I had thought about this type of issue. I remembered that you needed a stack, but couldn't see why at first, so I started thinking about it without using a stack, talking my way through everything. As I worked through the ideas with example values, it became apparent that you needed the stack to be able to get the trailing 0's right. :-) So then the needed algorithm fell together quickly. Only took maybe 3 or 4 minutes, but it was definitely not something I had stored away in the back of my head (and if I had, then the interviewer should have presented a different challenge, since the intent was to get a glimpse into the thinking and problem-solving process). My own favorite was to ask someone to think aloud through the processing of working out an algorithm for scoring a bowling game. A bit too involved to work it out completely in less than an hour, but surprising in its complexity, and almost always likely to force someone to backtrack once or twice along the way. It's very revealing to get someone to work through something like this, even if they don't have time to finish.

Interview Candidate on Sep 6, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.