Important: Pick One Language for the Coding Interview

I wanted to clarify the programming language requirement for the interview.

I was under the impression that I needed C++ or Java to do the interview, and that in some cases C would suffice. But I also felt the need to know Python, since it is also widely used.

A further reason for getting deep into C++ and Python is I want to be able to go from interview to hiring and be productive on the first day.

The verdict: pick one language for the interview.

So that's that.

What to Look for in Your Interview Language

Use a language you're comfortable with. Which in my case means practicing a lot, because PHP won't fly (I have 15 years with my old buddy PHP).

Choose a programming language that the interviewer will understand. See below.

I had to steal some of this from a blog post by Brian Jordan, and that article is not available. I get a 522 timeout error. So I rescued it for you with the Wayback Machine:

Ideally you’re most comfortable with a language that your interviewer has used before, but at the very least it should be readable by a wide audience.

Some solid, standard choices for interviewing, then, are: Java, C / C++ / C#, Python, Javascript, and maybe Ruby. PHP, AS3, Lua, Haskell, Go, LISP/Scheme and the ilk are potentially appropriate when the company uses them.

If you’re using a non-standard feature of your language that might not show up in others (dense Python list comprehensions, Ruby functional programming techniques, higher-order functions) — it's a good idea to be cognizant of the interviewer's comfort with the language and gently offer explanations of concepts they might not have exposure to yet.

...all things equal, bias slightly towards the language your target companies use if it’s one of the ones you’re most comfortable with.


C++ can be daunting. Right now I feel almost everything is a chore. Some of this comes from needing to allocate and ensure that values exist in a data structure, and if not, prefilling them so that accesses are predictable. It's a matter of growing a data structure on demand when you can't be assured of the final size. This is just one example. Java probably makes this much easier, but wanted experience with C++.


When I jump to Python, I'm not as slow, and I can knock out working code pretty quickly. Most of the language is still new to me, but learning and practicing with it is much faster than in C++, because there's less typing and head-scratching as I go along. Python has gotchas, though, since every instance of a data type is an object, and therefore every variable is a reference to an object.


I'm skipping Java in favor of C++ in order to get exposure to C++. My assumption is that going from C++ to Java would make life easier, but I want experience with a close-to-the-metal language, and the pains and detail-oriented requirements that come with it. I have to pay my dues.


I doubt I'll be pushing code the first day. You'll take time getting up to speed with the language and tools at your new employer.

My choice

I'll be going with Python. It's not as leet-pants as C++, but I just need to get hired first. Once I'm hired, if my job is in C++, you can bet I'll rock it. It all just takes time and practice. But right now I have to spend my time wisely.

Python's expressiveness is terse and powerful. Of course, I'm dealing with abstractions that make completing tasks in Python a breeze, but at least I know what data structures, algorithms and big-O considerations that lie beneath the abstractions.

You can represent linked lists, trees, and all that good stuff with Python. You'll be using objects and references, but it still gets the point across. My fallback is that if I need to do something with pointers or memory allocation, I can just knock it out in C.


From the stolen article:

Make sure you have at least the following operations down pat:

  • Initializing and using hash-backed maps (dictionaries) and sets
  • Performing queue and stack operations (whether using an array, like with Ruby’s pop/shift, or an explicit standard library implementation like Java’s Stack and Linked List-backed Queue classes)
  • Defining classes with constructors and attributes, static and instance methods, and defining a subclass and interface
  • Throwing exceptions for (1) invalid input and (2) custom messages
  • Iterating through arrays and dictionaries (both key and values)—including iterating while maintaining an index (Ruby’s eachwithindex, Python’s enumerate)
  • Casting between strings and integers
  • Strings: get character at index, get range, concatenate
  • Initializing 2d arrays
  • Arithmetic: modulus (remainder), division (if the first operand is an integer, will it round the result to an integer?), rounding (ceiling and floor)
  • (Bonus) Switch statements
  • (Bonus) Built-in language sorting. Quickly defining a comparator to sort an array.
  • (More advanced candidates) The 5 standard bit manipulation operations (L/R shifts, not, or, and, xor)

Have some opinions about it

  • What do you like about language X?
  • What don’t you like about it?
  • How does it compare to (another language you profess to know)? Similarities/differences?
comments powered by Disqus