I’m gonna depart somewhat from my usual practice here today, and talk about something that more or less normal people might be interested in :) and talk more explicitly than usual about The Employer. I will also put in an odious subhead, to help normal people find it; regular readers are invited to read it ironically:
How to Ace that All-Important Google Coding Interview
Note that this isn’t actually about how to ace that all-important Google coding interview, but it might help some people do better on it.
First, some credentials: I’m a SWE (SoftWare Engineer) at Google’s New York City office (Google NYC). I do candidate interviews, both for interns and full-time applicants, both on the phone and in person. Many of these are the archetypal Google coding interview, where you come in and say Hi, and then the interviewer gives you a little problem to write the code for a solution to, in basically the language of your choice.
(Not all Google interviews are like this, but if you’re applying for a job at Google that involves coding in any way, some of your interviews will be like this; likely even most of them will.)
One thing I’ve noticed recently, and that this weblog entry is about, is that people tend to pick Python as the language to do their interview coding in, even if they aren’t actually fluent in Python.
I don’t know why anyone would do this, but I’ve heard the same thing anecdotally from other interviewers, and just the other day I had a candidate tell me that while e was actually more fluent in C++, e was going to do the interview problem in Python because it was “more appropriate for the interview context” or other words to that effect. (It turned out eir Python was not all that good, and that fact did not improve how the interview went.)
Maybe there is a page out there on Quora, or LinkedIn, or the vast ecosystem of How to Ace that All-Important Google Coding Interview links, that encourages everyone to do it in Python. Maybe there are even recruiters who suggest it as a good language for the interview if you are fluent in it, and some people falsely assume that they are fluent because they know about the colons and indentation conventions.
Maybe the thought, the meme, is that since Python is supposedly good for quickly developing short one-off programs, and that’s pretty much what you’re doing during a code interview, Python should be good for code interviews.
Here’s the thing, though: Python is good for quickly developing short one-off programs only if you’re actually fluent in Python. Otherwise, you will do better using whatever language you are in fact fluent in.
(Ideally one of the Official Google Languages, which are, in alphabetical order and lower case: c++, go, java, javascript, and python; and also including any other language specifically mentioned in a job listing you’re applying for, if any. If you can absolutely rock the interviewer’s socks in Haskell or Oberon or LISP or something, I’d say go for that, too, but only if you can really rock their socks, not if you just think you can; and those are hard to tell apart from the inside. So maybe play it safe.)
What does it mean to be actually fluent in Python? As above, it’s not just knowing the basic syntax with the colons and indenting and all. Before using Python for an interview, rather than your actual preferred language, you should be sure:
- You are comfortable writing Python code, and have done a significant amount,
- You know what __init__ does,
- Writing “self” in the right places (and not in the wrong ones) comes naturally,
- You know what “self” is for,
- You know that it doesn’t actually need to be spelled “self”,
- You know why it always is, despite not needing to be,
- You know how to code a list comprehension, and do it naturally when appropriate,
- You know that range() only operates on integers, and what do to about this,
- You know how to compensate for method parameters being untyped,
- You could add two or three more things to this list with a bit of thought.
And yeah, that is a relatively high bar; you want to show off your problem analysis and design and coding skills, and you don’t want your unfamiliarity with your chosen tool to get in the way of doing that.
In general I’d say just always go with your preferred language (from the Official List, with caveats as above). But if you’re convinced that the interview will really go better in Python, check yourself against the list above. And then consider using your preferred language anyway, one more time.
The above is solely the opinion of the author, and in no way an official position of his employer, or anyone else. Google has some pretty good advice on this general subject that you’d be well-advised to look at; see for instance https://careers.google.com/how-we-hire/interview/.
Hm?