Tech IndustryApr 21, 2021

Google asking for preferred interviewing language c++ vs Java

I usually do algorithm problems with c++, very familiar with the algorithm stl. Problem is my coding style might be nitpicked because I haven’t use it professionally. Do I have to use smart pointers? I also have the feelings that c++ interviewer tend to be competitive programmers.. Should I still choose it? I am proficient at Java too but it is so much more verbose that might slow me down. Which one? Or is it fine to mix and match in google interviews?

Facebook liam Apr 21, 2021

Use STL algos and containers, a lot. Chances are you will not need any smart pointers other than for proper signatures.

ByteDance lubba OP Apr 21, 2021

So c++?

Microsoft sigmafry Apr 21, 2021

You should be fine with c++

Microsoft bdhdysp Apr 21, 2021

Use the language you’re most comfortable with. That’s it.

Google theUser_ Apr 21, 2021

Unless your interviewer expects you to write in particular language, eg. to check your domain knowledge, use your strongest language. If Google is asking for preferred language it means that they want to match interviewers who have experience in the language, to check if your usage of the language is correct. It is unlikely that you will be evaluated only on style. Also don't overuse the STL, during coding you can ask if you can use STL function of write your own version. The answers will depend on the problem and on what the interviewer is looking for.

ByteDance lubba OP Apr 21, 2021

I don’t have professional experience or domain knowledge in that language but am good at solving algorithm problems with it

Google theUser_ Apr 21, 2021

Then you should be fine to use C++. Just make sure you know basic constructs. I often see people who are choosing c++ just to showoff on the interview and they don't know well established syntax, data structures or STL functions.

Western Digital WLLo76 Apr 21, 2021

I’m a C programmer and use C++ for interviews. As long as you write decent code, not knowing something like smart pointers shouldn’t be a huge deal.

Facebook chavorale Apr 23, 2021

After interviewing dozens of candidates over the years, I am always mind blown by people chosing c++ or java for the coding interview. Any problem, even simple, require 2 to 3 times more code than the same in python or javascript. Also c++ and java code is WAY more complex to get it right, so many more ways to make mistakes. Big part of the job is to chose the right tools for the problem at hand. I see it as an orange flag when people chose c++ and java for the coding interview. They better nail it from start to end. If they chose an overcomplicated language and then forgot a ; and have a solution that doesn’t even compile, this is red flag.

Microsoft gdvvv Apr 23, 2021

Really? How does any of this make any sense? 1) A missed semicolon is found by intellisense immediately 2) What if they are an Android developer? Or work in finance in perf critical systems? Your best bet for interviewing is to use the language you’re most comfortable in, not the one with the most concise code. Please tell me you don’t think those “1 line beats 99%” solutions in leetcode are actually good code 3) Sheesh if you think most code should be written in python or JavaScript… what’s that about right tool for the job? Think harder, man. No offense but these are terrible interviewing criteria. Truly terrible.

Microsoft gdvvv Apr 23, 2021

In your mind “best tool for the job” probably means “simplest code on a whiteboard” but that’s a truly false way to understand what that phrase means. For an interview the best tool for the job is the one you understand the best. Which may or may not be the most syntactically concise code. But what interviewer in their right mind would judge someone for missing a semicolon, or for saying .size() instead of .length() on a Java string? A bad interviewer.