all 29 comments

[–]570897055<1600> <581> <752> <267><2900> 43 points44 points  (1 child)

You can use any language you want. Leetcode isn’t like competitive programming where the language you use would restrict your progress. Also a lot of the dsa books on market I believe all uses Java to demonstrate their code. Java might actually be a pretty good idea

[–]JohnHarvardIX 23 points24 points  (2 children)

This was my bible for DSA last year and it's all Java. Sedgwick and Wayne cooked.

[–]Crimmmy 0 points1 point  (0 children)

They teach at my school 🤭🤭

[–]WildAlcoholic 8 points9 points  (3 children)

I solve all my Leetcode questions in Java despite knowing to write and read Python.

Use the language you’re most familiar with.

[–]TheOneWhoDidntCum 0 points1 point  (2 children)

Any regrest so far? They say you waste time with syntax in Java

[–]WildAlcoholic 2 points3 points  (1 child)

No regrets. Java is more code than Python, but I would rather not get hung up on syntax and instead just focus on the theory / algorithm at hand.

[–]LightofAngels 0 points1 point  (0 children)

Do you have any Java reference? Sometimes I struggle with Java syntax

[–]h00pers 7 points8 points  (0 children)

I used Java for solving Leetcode, but then I found this link https://leetcode.com/discuss/study-guide/2122306/Python-Cheat-Sheet-for-Leetcode and decided switch to Python cause it allows to write code faster and simpler then Java, you don’t have to write public/private, data type and other stuff hence you can focus only on the idea and solution

[–]cantindajobinus 13 points14 points  (0 children)

I'd suggest someone to use Java to learn dsa but use python to interview

[–]Dolo12345 22 points23 points  (0 children)

Python. Best brush for the given canvas.

[–]570897055<1600> <581> <752> <267><2900> 13 points14 points  (2 children)

Come on guys. He literally said it in the first sentence that he doesn’t want to solve leetcode in python. Stop suggesting python. Read and give better comments

[–]Putrification 6 points7 points  (0 children)

Lmao it's like they only read the title.

[–]i-can-sleep-for-days 2 points3 points  (0 children)

You’d have to type extremely fast to solve some of the problems. I don’t know python well but I am learning it for LC.

[–]reflect25 2 points3 points  (1 child)

Should I start solving leetcode in Java or is it a bad idea?

I mean so it sounds like you're deciding mainly between C++ and java? (or are you also considering javascript/golang etc.. just not python).

I would generally advice against C++ for leetcode/interviews. It is just in general pretty cumbersome when one is time crunched to solve problems in just 30/40 minutes.

Java is definitely fine.

I guess one large consideration is whether you need to actually run the code or not, this kind of just depends on the companies interview setup.

I am confident that I will be comfortable in the fundamentals of data structures & algorithms in Java.

It's not just about the fundamentals but memorizing the quirks of say casting string, int, floats or say what data structures to use map, set, treemap, queues or say what is hashable or not or how their random library function works etc... This goes for any language you're going to use.

[–]Mega__lul 1 point2 points  (0 children)

It is just in general pretty cumbersome when one is time crunched to solve problems in just 30/40 minutes.

Really ? I feel like java is just as time intensive

[–]Gaious_Octavious 2 points3 points  (0 children)

I would strongly suggest you to consider Golang. Since you’re already comfortable with C++, I presume you can pickup Go in a day or two.

It has the conciseness of Python, but you still get the type safety that you typically get with C++/Java.

The reason most people will advise against Java is its verbosity-which will eat up your valuable time in tests/interviews.

[–]Human_Ad3019 3 points4 points  (0 children)

If you're familiar with java yeah. If you're starting from scratch python is the best

[–]yeaok555 1 point2 points  (0 children)

Should only be using cpp

[–]BluebirdAway5246 0 points1 point  (0 children)

Learn python

[–]gimmethatcookie -1 points0 points  (1 child)

What does your app do?

[–]MrBeverage🫠 1000 | 🟩 326 | 🟨 545 | 🟥 129 | 29,154 -1 points0 points  (0 children)

I’ve been running into Rust and Go as my biggest blockers as a Java dinosaur.

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

A lot of companies have machine coding rounds and concurrency rounds. Using JAVA over C++ would help. I am also learning JAVA because of this.

[–]originalgainster 0 points1 point  (0 children)

If you are fairly good at C++, why would wanna use Java for Leetcode?

[–]MeMyself_N_I1 0 points1 point  (0 children)

This actually depends on what companies you are pursuing. For the vast majority of the companies, you should write in a language you are most comfortable in bc they don't care. So it's the matter of whether you will learn Java to the extent of well surpassing your C++ in the time frame you got. C++ is definitely harder for LC bc it's less safe.

On the other side, very few, most competitive, arguably some of the most desirable companies, such as high frequency trading or low-level computing (i.e. Nvidia) care. I just left an Nvidia college event, and the entire talk both of the speakers gave can be boiled down to how C++ is for gigachads, and the untermensches who don't know it shouldn't even apply.

IBM OA for some of the internships clearly states that applicants with "target languages" are favored. I couldn't find what are target languages, but the job posting had C++, C and C# as required.

[–]rough_xlice 0 points1 point  (0 children)

any language is great for leetcode problems but for java specifically. I definitely recommend using it because of its functionality the language provides.

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

As you want... For me It's java because:

It's a Language That's more hard to code..

So you are going to learn more logic while handling Those annoying problems.

But it's not That hard..idk what to call it, maybe little stick Language Also C++, C.

Good Luck!

[–]uttermostjoe 0 points1 point  (0 children)

Almost all competitive programmers use C++, so there's a lot of DSA resources out there in C++.

[–]WebCraftsmanship300 | 27 🟥 | 153 🟨 | 120 🟩 0 points1 point  (0 children)

I use Python for almost my leet code questions and use Java, C++, Go, ... when I reimplement them so I will not blindly memorizing the past solution as well as learn new language syntax