10

I understand that this is quite a general question and it depends on the company, but I will try and explain.

I was given a problem where I had to write some code to verify a sudoku puzzle was solved correctly (inputted using a 2 dimensional array). The interviewer had me go to a https://code.stypi.com page, and had a template ready for me. He watched me write the code to verify the sudoku puzzle, and asked me questions about why I did it the way I did.

Now, using the website he gave me, I couldn't compile, run, or debug the code (I asked him). It was equivalent to writing it in a text editor, and hoped it worked. I finished the code up, and the interview ended. I was told I will be contacted when someone reviews the code.

As soon as it ended, I of course tested the code to see if it worked. There were minor errors, such as redeclarations of variable names and variables that were undefined (because I renamed some, and didn't think to change the parts where I was using it).

Besides those errors, I had one major one. This is the part that actually messed up my algorithm. I switched up a + and - in one spot, so the code didn't work as it was suppose to because of this. With that said, if you switched the + and - in that one spot, and fixed like 1 redeclaration and 1 undefined variable, then it worked perfectly.

This was my first interview, so I really don't know how well I did. If I were writing code and just going at it by myself, I would've been like, "wow, I can't believe I only have 4 errors after writing that..." after compiling.

Is this a big deal, or is the company trying to determine whether or not I have basic programming skills? I feel as if it is unfair for them to take this harshly, because I couldn't test or compile it - which is obviously unrealistic.

EDIT: The real error was also easy to track down. Fixing everything took me less than 3 minutes after the interview ended.

2
  • 9
    Do not underestimate the value of knowing how you think and work. This is very important when deciding if you would be a cultural fit. I would personally not expect perfect code without being able to compile and run, but I would really like to know how you wrote it. Dec 8, 2013 at 13:15
  • 1
    I would absolutely follow up after the interview, and I would consider including the working code.
    – kleineg
    Mar 13, 2014 at 14:25

5 Answers 5

15

Is this a big deal, or is the company trying to determine whether or not I have basic programming skills?

The only people who can really answer this question are at the company where you interviewed. Nobody here knows for sure what their goal was with this task, nor how they will score it. We can only speculate.

Most companies would be more interested in your general skill level, your approach, and the explanations you gave to their questions as you wrote your code.

But some companies view these exercises as a measure of excellence and set them up such that they are pass/fail. If you write elegant code and it works, you pass. If not, you fail.

In my company, we are more in the former category. We are typically more interested in overall understanding and approach than exact correctness.

Another factor that comes into play is the experience level associated with the role you are applying for. A Junior Developer may not be held to the same standards as a Senior Software Architect, for example.

I feel as if it is unfair for them to take this harshly, because I couldn't test or compile it - which is obviously unrealistic.

It's hard to characterize anything in an interview as "unfair" - particularly when you don't know how you are being scored/judged. Almost certainly all the other candidates for this job are going through the same exercise. So, if it's "unfair" to you, it's similarly "unfair" to them as well.

As far as "unrealistic", unless you applied to a company that's in the business of selling "code to verify sudoku puzzles", of course it's unrealistic. That's the nature of interview tests. I guess we could argue the value of such a test for this particular job. But, good or bad, that's how some companies operate. And if you want a chance to get hired at their company, you go through their interviews, and you play by their rules.

3
  • And a good deal of how much this will hurt is that you are being compared to how well the other people who were interviewed did. If they made more mistakes or couldn't solve the problem at all, you are in good shape, if they did it with no mistakes, it could be a deal breaker for you.
    – HLGEM
    Dec 4, 2013 at 13:57
  • Unrealistic exercises have a way of coming true. Java, for example, has a lot of mundane tasks built in to the standard libraries. I used to be the kind of guy to say that finding duplicates in an array is unrealistic because nobody writes code that low-level in Java. Then I found a pair of methods which work together to form 5 levels of nested loops to search for duplicate integers in an array. I got to replace the most unreadable 150 lines of code I have ever seen with a new HashSet<Integer>(). So "unrealistic" interview tests can be quite valuable.
    – Brandon
    Feb 21, 2014 at 21:03
  • I think the "will never happen" feeling about this question is much more related with the "you can't verify if this works" then with the specific "check if the sudoku is solved". I myself cannot think of many situations were you have to write code you can't verify, and most of them either wouldn't apply to a junior, or would be caused by severe fixable workflow mis-designs...
    – o0'.
    Apr 2, 2014 at 13:29
7

In general, minor errors when whiteboard or text editor programming are not a big deal. Syntax is less important than concepts and how you approach the problem at hand.

That said, redeclaration of variables seems like a big deal to me. It indicates that you gave them bad names, had functions that were too long, or are simply not careful.

And switching the operators might be a big deal, since the way you coded it might make such an error non-obvious. The problem there of course isn't the error, but that your code lends itself towards errors.

Especially for a problem so trivial as verifying a sudoku solution, I would be concerned about how those errors would grow in number and severity with a real problem - compiler or no. Even if in general little errors aren't a big deal.

5

Depending on the level of proficiency you've stated, what the company is expecting and what you said in the interview itself, this could vary from a huge deal to being rather trivial. You could have done manual tests of walking through the code to verify functionality which could have caught some of the errors. Did you ever state anything about the quality of the code you were producing? If so, then that would be where you may have issues. For example, if you claimed the code to be flawless and perfect then you could have problems as the company may question your ability to be honest.

While it took you less than 3 minutes to fix it, does the company know this? Did you send a follow-up thank you message with this in the notes? If you did then you're relying on the company to see that you can admit errors and value this. On the other hand, the company may view verifying a Sudoku solution as something that is easy to verify where errors tend to be things that may be hard to overcome.


As you're in high school, chances are this isn't likely to be a big deal. If you were a developer with 5 years of experience with a university degree and made these kinds of errors it may be taken another way.

1
  • The company does not know that I fixed it - at all. I did send a thank you, but didn't even mention the code that I wrote. I also didn't state a very high level of proficiency, and I don't have a degree (still in high school). I didn't state the quality of the code, and I hope that the interviewer took my question, "Can I debug?" into consideration.
    – hetelek
    Dec 4, 2013 at 1:02
2

Not a deal breaker.

I would email them the fixes if you feel confident in it. That would let them know you were thinking about it, and working hard.

When I interview with a whiteboard, I am usually looking for big picture items, but if there are gross errors, and they do not attempt to "mentally" run it, that can be a bad sign. The flipped +/-, is probably not a big deal at all.

-1

Is this a big deal, or is the company trying to determine whether or not I have basic programming skills?

It should not be a big deal. Pretty much nobody writes code without simple errors in one go.

But the kind of company where this is not a big deal is also the kind of company which will let you use a compiler in a test. So I suspect that it is relevant for them.

I feel as if it is unfair for them to take this harshly, because I couldn't test or compile it - which is obviously unrealistic.

Indeed it is unrealistic. Code writing, in general, is not done without a compiler in hand to check.

It is unfair since it rewards an ability which is not really relevant to the work: to write correct code without needing a compiler.

Since interviews work both ways you might wish to consider: have they passed your criteria for a company you wish to join?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .