You need solid mathematical skills as well as solid Data Structures and Algorithms skills. Leetcode is mostly mathematics and Data Structures and Algorithms. Quite often, they use some obscure, rarely known structures/algorithms/mathematics. Why did you stop at OOP? Java is all about OOP and in order to become a proficient Java programmer, there is absolutely no way around OOP. In short, you cannot program in Java if you can't do OOP. Answer from desrtfx on reddit.com
๐ŸŒ
LeetCode
leetcode.com โ€บ problemset
LeetCode Java Problems
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
๐ŸŒ
LeetCode
leetcode.com โ€บ problem-list โ€บ mmza0utr
JAVA QUESTIONS 50 - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
Discussions

What should i learn in Java to be able to solve on leetcode?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full - best also formatted as code block You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
๐ŸŒ r/learnjava
11
1
January 23, 2024
JAVA OR PYTHON for leetcode?
If you're only doing it for job interviews then pick python. If you really want to understand how the code you write impacts the space/time complexities, how optimisations impact your code, You want to open the hood and see how the car works? Pick C++/Java More on reddit.com
๐ŸŒ r/leetcode
59
32
January 27, 2025
Is it worth switching to Python after doing 85 problems in Java?
I went from python to java to c++. I say stick with what you are comfortable with. More on reddit.com
๐ŸŒ r/leetcode
81
99
July 1, 2024
Is it worthwhile to do LeetCode problems as a Java/Spring dev?
In all the interviews where I got through, I didn't have any code challenges, and I'm going on 5 years of experience. More on reddit.com
๐ŸŒ r/taquerosprogramadores
33
19
January 23, 2025
๐ŸŒ
LeetCode
leetcode.com โ€บ problemset
LeetCode - The World's Leading Online Programming Learning Platform
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
๐ŸŒ
GitHub
github.com โ€บ javadev โ€บ LeetCode-in-Java
GitHub - javadev/LeetCode-in-Java: Java-based LeetCode algorithm problem solutions, regularly updated.
Java-based LeetCode algorithm problem solutions, regularly updated. - javadev/LeetCode-in-Java
Starred by 208 users
Forked by 103 users
Languages ย  Java
๐ŸŒ
LeetCode
leetcode.com โ€บ discuss โ€บ interview-question โ€บ 804201 โ€บ java-coding-interview-questions
Java coding interview questions - Discuss
August 21, 2020 - Write a java program to accept a variable x. x can be any number from 1 to 230-1. Generate a file with x number of lines and each line consist of a string th
Find elsewhere
๐ŸŒ
Medium
medium.com โ€บ @YodgorbekKomilo โ€บ mastering-leetcode-with-java-techniques-patterns-practice-b98cef014c8e
๐Ÿš€ Mastering LeetCode with Java: Techniques, Patterns & Practice | by Yodgorbek Komilov | Medium
April 23, 2025 - Are you preparing for coding interviews and want to crack LeetCode problems efficiently using Java? Hereโ€™s a practical roadmap to level your problem-solving skills with tried-and-tested patterns and techniques.
๐ŸŒ
Udemy
udemy.com โ€บ it & software
Data Structures & Algorithms in Java + 150 Leetcode Problems
3 weeks ago - Practice problem 4 uses the two-pointer method in Java to check a palindrome by lowercasing and removing non-alphanumeric characters, moving left and right for an O(n) solution. ... Picture this: You're sitting in the hot seat of a coding interview, faced with a challenging DSA problem. How do you tackle it with confidence and perfection? That's where my course comes in. In this course, I am taking you straight to the heart of the action โ€“ the top 150 Leetcode problems.
Rating: 4.5 โ€‹ - โ€‹ 1.63K votes
๐ŸŒ
Reddit
reddit.com โ€บ r/leetcode โ€บ is it worth switching to python after doing 85 problems in java?
r/leetcode on Reddit: Is it worth switching to Python after doing 85 problems in Java?
July 1, 2024 -

I have solved 85 problems (but around 60 of those are leetcode easy) in Java. Now I am realizing how much time python can actually save just because the syntax is concise and how easily logic can be converted to code. And regardless of what anyone might say, Java IS verbose.

I know the syntax of Python but not too familiar with the details like I am in Java(for eg primitives vs objects in memory, how objects and references work). Will it take a considerable amount of effort to relearn those things in python?

Also does python lack some stuff when compared to Java collections/ C++ STL?

I'd say I'm not too far from when I started, and it feels like I have done things in a random unstructured way. I have only done a few topics like some Arrays, binary search, two pointers, recursion and currently doing OOP.

๐ŸŒ
The Coding Forums
thecodingforums.com โ€บ programming languages โ€บ java
Leetcode Problems | Java | Coding Forums
May 2, 2024 - Whatever format feels natural to you. Convert the logic diagram into pseudo code. Desk check the pseudo code. This means using a piece of paper to keep track of the value of every variable, use your brain as the CPU.
๐ŸŒ
AlgoMaster
blog.algomaster.io โ€บ p โ€บ 15-leetcode-patterns
LeetCode was HARD until I Learned these 15 Patterns
July 21, 2024 - In this article, Iโ€™ll walk you through the 15 most important patterns I learned that made my LeetCode journey lot less painful.
๐ŸŒ
Medium
medium.com โ€บ @abhishek.talakeriv โ€บ java-leetcode-solutions-part-1-efb531dbd72a
Java LeetCode Solutions Part 1. Commonly asked interview questions. | by Abhishek vt | Medium
November 4, 2024 - Java LeetCode Solutions Part 1 Commonly asked interview questions. Hello all! In todayโ€™s session, weโ€™ll tackle common interview questions sourced from LeetCode, offering straightforward โ€ฆ
๐ŸŒ
LeetCode
leetcode.com โ€บ problem-list โ€บ array
Array - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
๐ŸŒ
Udemy
udemy.com โ€บ development โ€บ software engineering โ€บ coding interview
LeetCode in Java: Algorithms Coding Interview Questions | Udemy
Interviewers from the most popular companies(like Google, Amazon, Facebook, Uber, Twitter etc.) often directly ask questions they find on LeetCode. It's hard to navigate through the large amount of problems(around 1500) to most important questions, this is what this course stand for.
Rating: 4.5 โ€‹ - โ€‹ 1.62K votes
Top answer
1 of 1
1

There seems to be confusion about what the LeetCode problem is asking the programmer to do. This is an example of why a link to the problem page included in the question body is helpful, when the source of the problem does have a page. This is typical of the programming challenge sites. (However, some of these sites require an account to see their problems.)

  • The int value, k, in the O/P code is the number of elements that were removed from the nums array. This is where the bug is. The value returned is supposed to be the number of elements that remain after the targeted values were removed.
  • LeetCode asks this problem be solved in-place. The expected solutions do not create an intermediate array, or other structures to temporarily hold data. Although the code in the question seems to have gotten away with it, this line int[] expectedNums = new int[nums.length]; violates that constraint.
  • I notice that the code in the question has a variable expectedNums. The automated judge described in the problem page also uses a variable with this same name. That hints that there might be another misunderstanding. The solution code is not expected to have a variable expectedNums. It is allowed to. But, if it does, the variable will be unrelated to the expectedNums in the code for the judge.
  • The description of the automated judge can be used to help design a solution to the given problem.

I don't want to give the O/P an answer with complete code. I believe it will be more helpful if the O/P spends time thinking about how to solve this.

  • Bear in mind that the automated judge will sort the first k elements of nums array after the removeElement method is called. In Java, that would be nums[0] to nums[k - 1].
  • The automated judge doesn't care what is nums [k] to nums [nums.length - 1].
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 43462158 โ€บ struggling-to-debug-java-solution-to-leetcode-algorithm
Struggling to debug java solution to leetcode algorithm - Stack Overflow
I was trying to solve this problem here: https://leetcode.com/problems/trapping-rain-water/#/description And my code is providing incorrect answers, but I can't understand why. When I look at it a...