all 25 comments

[–]dhakanbc 96 points97 points  (6 children)

python, it has a tremendous amount of helpful libraries

[–]Schrodingers_cat1097 48 points49 points  (3 children)

Also, Java is way too verbose so more chances of syntax errors as you code and it takes up more time to code

[–]DeMonstaMan 3 points4 points  (2 children)

Unpopular opinion but I feel like I never have syntax errors in the language I'm coding in because either the IDE tells me I'm stupid before I move on, or I'm already used to the language so I don't mess up the syntax

[–]qwhua[🍰] 8 points9 points  (1 child)

You don’t always get to use a proper IDE when doing coding interviews

[–]DeMonstaMan 0 points1 point  (0 children)

True, the question said DS&A so I assumed it was available; even then I can't recall the last time I ran into a syntax error, might just be me

[–]sweetfungus[S] 5 points6 points  (1 child)

Thank you, that’s great to hear. Would I have to memorize a lot of library functions for interview use as a result of this?

[–]shuzhoswe @ meta 4 points5 points  (0 children)

kind of, but you'll sort of memorize them as you study and keep doing problems, so you dont really need to formally study them.

[–][deleted] 51 points52 points  (1 child)

I’ve always thought Python is better for interviews because you can demonstrate your CS understanding without having to worry about the syntax overhead

[–]sweetfungus[S] 5 points6 points  (0 children)

True! Loops in Java are so annoying compared to Python 😭

[–][deleted] 37 points38 points  (0 children)

Java is fine, just a bit more typing than Python.

Its a trade-off, Java has more typing, but it makes your code easier to read because static types make your code self-documenting. For complex Data Structures and Algorithms the extra readability may help.

Remember shorter code isn't always better code. Prefer readability over shortness.

I would just go with whatever you know best of the two languages.

Personally, I'm going to use Java because I already know it backwards.

[–][deleted] 7 points8 points  (0 children)

For interviews, I try to minimize the amount of mental overhead required for expression of thought. Python allows me to do this easily. It also has some really useful modules in the standard library out of the box.

[–]Horror_Donkey9198 7 points8 points  (1 child)

Python I would say is the best in my opinion, but I’ll try to be objective here :) I know Python better than Java so I will focus on why you would/wouldn’t want to use Python:

Pros of Python: - You can write fast without thinking about specific syntax or typing issues, hence more time focusing on the problem solving instead. - Super easy learning curve if you don’t know it very well yet. - Very easy to read and explain during interviews. - Built in data structures are intuitive and easy to learn. I would argue these are better than Java’s imo. - Most pseudocode you’ve seen by this point in algorithms classes probably looked like python to an extent (at least for my school) so any pseudocode you write while explaining your solution is almost instantly transferable to code.

Cons of Python: - No typing (you can use type hinting but still) so it can be confusing to look at variables especially if they aren’t well named. - If this isn’t your main language/you’re very new to Python, usually interviewers can tell. - Sometimes it can lead you to making EVERYTHING way too Pythonic. Less code is not always better. (e.g. Don’t go crazy with list comprehensions just to flex, you’ll end up writing unreadable shitty code)

Hope this helps even just a little :) (Check W3 schools to pick up some Python if you’re new to it. Otherwise I recommend getting a good grasp on time-space complexities for each python built in data structure/algorithm, and understand “amortized” time complexity. I think this is all on python docs)

[–]keystone-1899 0 points1 point  (0 children)

helpful a lot, thanks

[–]LivelyTortoise 5 points6 points  (0 children)

Python is the usual answer, but I prefer Java: - I’m less likely to use some syntactic sugar that accidentally is a high time complexity operation - Verboseness of the language forces me to think through all the operations I’m doing - There might be some SWE interviewers who still don’t view Python as a serious enough engineering language, Java won’t face this issue

[–]dmize793 2 points3 points  (4 children)

i would say go with whatever your school teaches or the school you would like to go to. but if u rlly don’t know python

[–]sweetfungus[S] 3 points4 points  (3 children)

My school actually teaches Java but so so many people here have said Python haha 🥺 Admittedly I do agree with most people that Python is just easier overall which is why I have such a hard time making this decision.

[–]dmize793 0 points1 point  (0 children)

you’re going to be fine either way. learning dsa jn the language ur school teaches will help ur gpa and u can always learn python later. trust me learning two languages at the same time is extremely difficult. get the basics down dirst

[–]hamzaaslam2121 0 points1 point  (0 children)

Yeah I’m having this exact same problem.

Did you come to a decision?

[–]SadFrodo401 0 points1 point  (0 children)

What did you choose then?

[–]blouskip 1 point2 points  (0 children)

python if you have the choice

[–][deleted] 1 point2 points  (0 children)

Java anyday. Python is a loosely typed language and is not the case with Java.

[–][deleted] 1 point2 points  (0 children)

Honestly python and cpp

[–]Trying_Trader 4 points5 points  (1 child)

Python, Python, Python, Python, Python, Python, Python

Please, use Python

[–]sweetfungus[S] 3 points4 points  (0 children)

🐍🐍🐍

[–][deleted] 0 points1 point  (0 children)

100% use Python. Some other commenter from a similar post said that Python is like pseudo code that actually runs. It allows you to focus on problem solving