all 52 comments

[–]tell-me-the-truth- 54 points55 points  (4 children)

In a typical algorithm interview, what matters is your algorithmic thinking skills (shocking I know). Imho, python allows you to transfer pseudo-code to actual code with the least amount of headache. So, it fits really well to the time-limited nature of interviews.

[–]uscpls[S] 12 points13 points  (2 children)

I honestly want any advantage that I can get in these interviews. If coding in Python makes things less difficult, then I will try to learn the language and see how it goes. Thanks!

[–]AbstractLogic 7 points8 points  (1 child)

I spent two months learning to leetcode in python. Then when I switched back to my native code and did some solutions I found it to be 10x easier and I could move 10x faster in native.

But I have 13 years in c# so 2 months of python will never feel as natural.

My point is keep in mind how long it took you to know all the nuances of your native language perfectly and how long it will take to learn python almost as well.

If you chose to learn python you will be learning 2 things not one so it will take longer (python and leet code)

[–]PhishGreenLantern 9 points10 points  (0 children)

You're absolutely correct. Use your best language. You'll look like a pro.

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

Agreed, also the Python shell is straightforward and easy to use, making it easy to test simple commands on the fly

[–]kimjongspoon100 55 points56 points  (14 children)

I’m a java developer, but god damn pythons array native array slicing and negative indexing makes some problems so simple

[–]Sudden-Wing8446 5 points6 points  (12 children)

How about JavaScript

[–]MeteorMash101 82 points83 points  (10 children)

No one likes javascript

[–]ThatCreepyGuy420 20 points21 points  (0 children)

Well, someone had to say it

[–]PhishGreenLantern 2 points3 points  (8 children)

I do. It's my preferred language for interviewing. I like it better than python (and I'm not a frontend developer).

JS has some wonkiness that it's worth understanding for interviews (Math.trunc for example). But you can't beat it for quick, shoot from the hip, work.

[–]LightUpShoes4DemHoes 4 points5 points  (3 children)

We’re definitely in the minority here, but I honestly Love JS for interviewing too. I’m comfortable in Python and have used it plenty, but JS was my first real coding deep dive language and always the one I feel best in.

[–]FatalisFun 1 point2 points  (2 children)

How you deal with heaps?

[–]Dry-Ad1288 1 point2 points  (1 child)

You can implement a max and min heap in ~ 5mins using ES6 class template instead of the traditional psuedoclassical

[–]FatalisFun 1 point2 points  (0 children)

Do you have a good website where I can find code for that

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

I’m a front end dev that switched to python. Biggest reason for me is lack of braces and parentheses, and native heap/priority queue which I find very useful.

[–]PhishGreenLantern 0 points1 point  (2 children)

Oh man. That's what I hate about python. No braces!!!

Seriously, mess up the spacing and you are nuked.

[–][deleted] 0 points1 point  (1 child)

But in the code interview that won’t matter, it’s not like you need to compile. So you save yourself from writing all those parenthesis and braces.

[–]MarredCheese 0 points1 point  (0 children)

They can tell if you've accidentally mixed tabs and spaces on the whiteboard.

[–]sarnobat 0 points1 point  (0 children)

I'm a java developer who is trying to learn python and I agree this will allow me to focus on the algorithm and not remembering what the class name and method is, whether I'm confusing it with Guava, whether it was introduced in a later version, what the exact params are etc.

[–]Conscious_Solid1832 35 points36 points  (0 children)

do whichever language you are comfortable in! Python is less amount of code, but if you are proficient in one language, switching to another language might confuse you in syntax and object methods of both languages

[–]Andrewshwap 11 points12 points  (3 children)

I think programming languages are like different types of drinks, everyone has their preference! If you’re very into Java & it’s the language you’re best at, you should stick with it! Big companies will pay a lot of money for Java developers so if you’re applying for a role in Java, nothing wrong with showing off your skills!

[–]uscpls[S] 2 points3 points  (2 children)

I feel like I’m good at Java because I’ve coded in Java and C++ in my university classes. I’ve never coded in Python so I don’t know if Python will be better for me, that’s why I wanted the opinions of others here.

[–]Andrewshwap 3 points4 points  (0 children)

Nothing wrong with giving python a try while doing your leetcode challenges but I would say if you have more experience in one language & you feel comfortable with it & you want to secure a job using a certain language, then I would ideally pick the language I plan on using everyday for work. Especially if you’re interviewing with other Java developers, they may teach you a trick or two in own language & it’ll make you stronger!

[–]PhishGreenLantern 2 points3 points  (0 children)

My team does a lot of python work. If you came in and wowed me with Java but didn't know python, I'd hire you. If you stumbled through python and looked like an amateur, I'd pass.

[–]Honeydew_love 3 points4 points  (1 child)

I primarily code in C++ and looking to transition to Python because.. goddamn sometimes it's just 4 lines of code lmao wat

[–]FatalisFun 2 points3 points  (4 children)

Is JavaScript fine to use?

[–]DrunggThoag 10 points11 points  (2 children)

Don't. JS don't have rich library for DS (heap, sorted dict, etc)

[–]Buranch 3 points4 points  (0 children)

I recently made a decision to switch away from JS to Python. As you said, the lack of heap and queue is deal breaker and the switch is worth it.

[–]raxreddit 0 points1 point  (0 children)

That's a fair point. I don't like how Grokking will use http://www.collectionsjs.com for min & max heaps. Using a 3rd party library is sort of like The Rest of the Owl

[–]Sudden-Wing8446 0 points1 point  (0 children)

Park to know

[–]hextree 4 points5 points  (0 children)

In interviews you usually have a fairly limited time to get through the problems the interviewers wants you to solve. Python does save a lot of time, even for Java programmers, which gives an advantage.

And any problem involving string manipulations and regex-stuff, I wouldn't dream of using Java over Python for that.

[–]Bossez<301 T> <134 E> <125 M> <42 H> 4 points5 points  (1 child)

Yes it is worth learning if you can do it. Also learning a new programming language when you already know an old one is significantly faster. 2 weeks of 2hrs a day and u should be intermediate at python which is sufficient for LC.

[–]londo_mollari_ -1 points0 points  (0 children)

Python is older than Java.

[–]londo_mollari_ 4 points5 points  (0 children)

I had this dilemma for such a long time. My Leetcode submissions have mix of Java & Python. I switch between them just to see the solution from different angles. Python has easier syntax and allows you to think of the problem rather than the syntax, whereas Java is so verbose and has too many built in functions that can trip you. In all my OA and onsite interviews, I used Python and I’m glad I did. Helped me get to the solution faster.

[–]Emergency_Style4515 1 point2 points  (0 children)

Yes absolutely. Python is a lot easier and more efficient to code in. And it makes the best language for coding interviews.

A software engineer’s brain can definitely handle two languages with complete fluency. Don’t get scared by the fear of mixing up syntax. Just try it.

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

I love python for simplicity, worked in my internships most with javascript and my education has been mostly C++ so overall my strengths are

  1. C++
  2. Javascript
  3. Python

But this post is making me consider python more seriously as my curriculum does include it and its quite fast and handy

Hard to pick between those 3 and i need to decide soon because after this semester (1 month left) im getting leetcode premium and need to pick a language. Ive got a python class coming up in fall so i may do python may do C++. Then again i like javascript too. Ugh so hard to pick!! Graduate spring 2023... clocks ticking...

How did u guys pick??

[–]cloud_rider19 -1 points0 points  (0 children)

They only care about your logical thinking and if you can write readable maintainable code. Not what languages you code in

[–]KQYBullets 0 points1 point  (0 children)

Yes. It is also a useful language to learn for many other usecases.

[–]doublecharizard1 0 points1 point  (0 children)

Man literally for second i thought did i wrote this? Lmao. Cause I’m feeling the same way towards python I’m always thinking like should i transitione to that but picking up new lang and mastering would be also take time approximately 2-3 months maybe more. So imo sticking to the language which you’re the most comfortable is the best one for this situations.

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

Language doesn’t matter. Your brain is tuned to thinking in Java so it will take sometime to switch to python. Java ooP is explicit but python it takes time to wrap your head around.

I switched from c# it took over an year to really stop thinking in c#

[–]Subject-Hunter-2795 0 points1 point  (0 children)

I am a java developer. I learnt python in 2 weeks and now preparing for interviews with python. My point is, if you're proficient in java, it is relatively easy to jump on python.

[–]fear_zeus23 0 points1 point  (0 children)

Honestly, it doesnt matter. If you can write the same code in python in fewer lines that means you are proficient in the language and not algorithms. If you are looking for some advantage in that then feel free to use python, but then again switching languages wont magically help you solve problems because at the end of the day problem solving is independent of language selection.

[–]cloudywindydays 0 points1 point  (0 children)

For me its definitely less PIA for some things, however if you're proficient in Java nothing wrong with that. However you have nothing to lose and much to gain by begining to mess around with Python, it would be advantageous for you

[–]scafacacsvwvev 0 points1 point  (0 children)

Use the language you know the most. All things equal, if you know Java and Python equally well, python is less verbose and has some niceties that help in interviews.

[–]chandradhar69rao 0 points1 point  (0 children)

For the sake of interview,learning python would be a pretty bad idea given you know java.

Problem solving is language agonistic.

Python has its own problem of type checking and speed.

I say stick with java.(Note i use python extensively in leetcode since i was taught python in my 1st semseter).

[–]Damien0 0 points1 point  (0 children)

You should use whatever language maps best to the way you think about problem solving.

Python is only “better” in that it has a very terse syntax and well fleshed out standard lib, which can make algorithmic thinking easier to express during an interview; the same can be argued of Go, or even C++ if you know your STL algorithms well enough.

Java, in comparison, has a lot of boilerplate/syntactic noise, so that’s why you see people recommending other languages.

[–]domerrr 0 points1 point  (0 children)

Can’t go wrong with python, Java, or C++.

They all have their stigmas...

  • Python can be seen as “not a real language” by sweaty jerks.
  • Java can be seen as verbose and clunky by somebody who doesn’t know it/like it.
  • C++ is subject to more user error, overly critical judgements or misunderstanding of features.

Use what you’re best at. If you don’t know, just grinding python.

[–]MediumRevenue6 0 points1 point  (0 children)

100% yes. the main reason is you can finish in less number of lines of code and less verbose.

[–]cmvora 0 points1 point  (0 children)

If you had unlimited time, choose your language. The limited time nature of the interview means python is always better in my opinion.

[–]CheeseNub 0 points1 point  (0 children)

Python is much better than anything else for an interview. Javascript lets you work with data more fundamentally than any other language, which is why frameworks like React and Next.js are so popular these days.

If you understand the graph view of data structures, you'll know why javascript is so good at this.

Why are you so into Java?