r/JavaProgramming 4h ago

Day 2 of my Java & DSA Journey – Solved Two Sum using HashMap (O(n))

3 Upvotes

Hi everyone!

This is Day 2 of my Java & DSA journey.

Today I practiced one of the most popular interview questions: Two Sum.

Problem

Given an array of integers and a target value, return the indices of the two numbers whose sum equals the target.

My Java Solution

import java.util.HashMap;

class Solution {
    public int[] twoSum(int[] nums, int target) {
        HashMap<Integer, Integer> map = new HashMap<>();

        for (int i = 0; i < nums.length; i++) {
            int complement = target - nums[i];

            if (map.containsKey(complement)) {
                return new int[]{map.get(complement), i};
            }

            map.put(nums[i], i);
        }

        return new int[]{};
    }
}

What I learned today

  • How HashMap helps reduce time complexity.
  • Difference between brute force O(n²) and optimized O(n).
  • Why storing previously seen values is useful.

I'm trying to improve my Java and DSA skills every day. If you have any tips for writing cleaner Java code or preparing for coding interviews, I'd love to hear them.

Thanks for reading!


r/JavaProgramming 7h ago

Ropes Torc AI Java Assessment need help

Post image
1 Upvotes

r/JavaProgramming 9h ago

I'm making you consistent to learn java and backend fundamentals. Roast my product; if found useful, upvote on Product Hunt.

Thumbnail
2 Upvotes

r/JavaProgramming 17h ago

Seamless Lombok, JaCoCo, and Other Java Agent Integration in Emacs with JAL

Thumbnail
1 Upvotes

r/JavaProgramming 21h ago

Difference between JWT, OAuth, and SAML

Thumbnail
javarevisited.substack.com
1 Upvotes

r/JavaProgramming 1d ago

Java or Go for full remote setup

10 Upvotes

For full (not hybrid) remote working setup. Is there enough java jobs for this or are Go jobs more inclined to this working setup???


r/JavaProgramming 1d ago

tarting my Java & DSA journey. I'll share what I learn every day.

9 Upvotes

Hi everyone!

I'm a Computer Science student from India and I'm currently improving my Java, DSA, SQL, and Web Development skills.

My goal is to solve coding problems consistently and become a software engineer.

I'll be sharing:

  • Java tips
  • DSA solutions
  • LeetCode explanations
  • Interview preparation notes
  • Small coding projects

If you have any advice for someone starting this journey, I'd love to hear it.

Thanks!


r/JavaProgramming 2d ago

Need help in Code

Post image
3 Upvotes

Paypal clone using java spring boot and kafka need help

Actually I was following @Mrunmai Dahare mam lecture in the vedio episode 3 : 16.21 timestamp I don't get what to change please help


r/JavaProgramming 2d ago

I'm half way there, kay?

1 Upvotes

r/JavaProgramming 2d ago

Mistake done when start to learn java

Thumbnail
1 Upvotes

r/JavaProgramming 2d ago

I Read 20+ Coding Interview Books — Here Are My Top 5 Recommendations

Thumbnail
javarevisited.substack.com
0 Upvotes

r/JavaProgramming 2d ago

Title idk

4 Upvotes

So I've been recently getting into java and I've been teaching myself alot and i genuinely enjoy coding little projects but ny progress has been slowing down because i only know the basics stuff you need to make the most beginner games like tic tac toe and and rock paper scissors, so are there any tutorials or courses i should be taking?


r/JavaProgramming 2d ago

Java & Moding

1 Upvotes

Hi, I've studied java , but sometimes I have questions about why a virtual stream is needed , except for downloading skins and communication , nothing comes to mind .


r/JavaProgramming 2d ago

Indians who recently got job offers (in IT) in Dubai or Europe or Australia from India - how you did it?

Thumbnail
2 Upvotes

r/JavaProgramming 2d ago

Hiring : Java Full Stack Developers

Thumbnail
2 Upvotes

r/JavaProgramming 3d ago

Java programing is exciting

Thumbnail
2 Upvotes

r/JavaProgramming 3d ago

I built a Tetris gamefrom scratch using MVC architecture. Looking for code review/feedback!

Post image
16 Upvotes

Hey everyone,

I'm currently working on sharpening my Object-Oriented Programming (OOP) and software design patterns, and I just finished building a custom Tetris game engine completely from scratch using Java Swing.

Actually, I haven't finished it yet and there are lots of things I am planning to implement on this one. But attached is the photo of my program running on the background.

I would love to get some feedback or a code review from more experienced developers on my architecture, package structure, or any potential logical improvements I could make!

GitHub Repository: https://github.com/EJConstantino-17/TetrisGame

Thanks in advance for any insights!


r/JavaProgramming 3d ago

Looking for Java learners to study together! ā˜•šŸ’»

Thumbnail
3 Upvotes

r/JavaProgramming 3d ago

Looking for Java learners to study together! ā˜•šŸ’»

27 Upvotes

Hey everyone!

We're building a free Java learning community for students and beginners who want to improve their programming skills consistently.

JOIN WHATSAPP GROUP:)

https://chat.whatsapp.com/ERcjXkqU9cmEXS9rBSy6dH?s=cl&p=a&ilr=4&amv=2

Discord :)

https://discord.gg/TEENUqVYZ

What we do:

šŸ“š Learn Java from the basics to advanced concepts

šŸ’” Solve DSA & LeetCode problems together

šŸ¤ Group study sessions and doubt solving

šŸš€ Build projects and stay accountable

šŸŽÆ Beginner-friendly environment

If you're serious about learning Java and want to stay motivated with others, you're welcome to join us!

Discord :) https://discord.gg/TEENUqVYZ

WhatsApp Community:

https://chat.whatsapp.com/ERcjXkqU9cmEXS9rBSy6dH?s=cl&p=a&ilr=4&amv=2

Let's grow together and become better developers! šŸš€


r/JavaProgramming 3d ago

I need some Advice maybe even a little help

5 Upvotes

I have been building a software program designed for retail traders. It is a Multi-System Trading Analytics +Risk Simulation Engine. I named it Trader-OS. Well one of the features it has is the Trade Importer that will eventually use API to access the csv files on different brokers platforms. My issue is I cant get it to completely decipher the data it refuses to add stop loss and take profits. When they are in the files. I started out manually entering every trade I made. Bit wanted it to be something that wouldn't confuse the customer. And this thing has been kicking my šŸ«. It is mostly written in Javascript and CSS. I use node.js and Electron. Any who. If anyone has any feedback or experience with what im building message me and help a poor man out. Lol


r/JavaProgramming 4d ago

Hi I now java basic should I start das after it or learn advance after this?

1 Upvotes

I now loops, statement and all I want to go forward what to do? Should I solve some basic dsa questions or what


r/JavaProgramming 4d ago

Beginner looking for a structured Java learning path and daily practice resources

Thumbnail
1 Upvotes

r/JavaProgramming 5d ago

Encapsulation in Java with Realtime Example

Post image
26 Upvotes

r/JavaProgramming 5d ago

How SOLID Principles Can 10x Your Software Engineering Skills"

Thumbnail
reactjava.substack.com
8 Upvotes

r/JavaProgramming 5d ago

Java Backend Projects That Stand Out to Recruiters?

24 Upvotes

What are some Java backend projects that recruiters actually find impressive but aren't already on every resume? I'm looking for ideas beyond CRUD apps (library, student management, to-do, e-commerce, etc.). What projects would make you stop and check a candidate's GitHub, and why?