0

What is the best language to Select for DSA Interviews? Java, JavaScript or Python or others?

Profile picture
Senior Software Engineer at Taro Community10 months ago

I am proficient in JavaScript, moderate in Java and Beginner in Python. If I have around 2-3 months  to prepare what would you suggest I go for?

What are the factors to consider when selecting the language?
In built data structures and proficiency or are there other factors to consider?

169
4

Discussion

(4 comments)
  • 2
    Profile picture
    Tech Lead @ Robinhood, Meta, Course Hero
    10 months ago

    When it comes to choosing a programming language for interviews, here's the algorithm:

    val yourBestLanguage = getCodingLanguage()
    if (yourBestLanguage.isSuperVerbose()) {
        // Possible values for concise language: Python, JavaScript
        self.learnConciseLanguage()
    } else {
        yourBestLanguage.useOnInterviews()
    }
    

    In your case, just use JavaScript. It's probably the most popular programming language on Earth, it's concise, and it's your best language.

    The tricky part with scripting/ultra-concise languages though is that sometimes the "black magic" you use to abstract away tons of logic are actually really inefficient. Make sure to understand the space/run-time of everything you're using from the language.

    Here's another similar question that may be helpful: "Should I learn Python for DSA Interviews?"

  • 1
    Profile picture
    Senior Software Engineer at Intuit
    10 months ago

    I’m also an interviewer at interviewing.io, what I observed is that folks who code in Python are able to talk through their solution with coding better than others who are coding in C++. Java is okay too. My strongest Language is Java, but I’m tempted to learn Python for interviews for ease. I would spend 5 days on learning Python if you have 3-4 months. Check out neetcode’s YouTube video for Python for coding interviews.

  • 0
    Profile picture
    Senior Software Engineer [OP]
    Taro Community
    9 months ago

    I settled on JavaScript since it is my best language.

    How do I handle the data structures that are not in built in JavaScript like Stack / Queue etc?

  • 1
    Profile picture
    Tech Lead @ Robinhood, Meta, Course Hero
    9 months ago

    How do I handle the data structures that are not in built in JavaScript like Stack / Queue etc?

    Just have them on-hand. If you don't, the interviewer will probably let you Google them. And if you're whiteboarding, you should just get them for free - This is all what I did as an interviewer at Robinhood/Meta.

    It would be extremely cruel for an interviewer to punish a candidate for using a programming language with less built-in stuff - It is inherently unfair relative to the other candidates using "fuller" languages. It also is worse for the interviewer because if they make you go on a side mission to build a primitive data structure from scratch instead of tackling the core of the problem, they get 0 real signal on you. If your interviewer does this, they are out to fail you, and there's not much you could have done to survive anyways.

    At a higher-level, I recommend understanding the perspective of the interviewer (i.e. the other side of the table) as this will help you make better decisions holistically going forward about what to prioritize. Check this out: [Masterclass] How To Be An Amazing Interviewer In Tech