Skip to content

Boopathi7706/leetcode-hub-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LeetCode Java Solutions

A collection of Java solutions to LeetCode problems, organized by difficulty, with JUnit tests for each solution.


πŸ“‚ Folder Structure

Easy/      β†’ Solutions for Easy problems
Medium/    β†’ Solutions for Medium problems
Hard/      β†’ Solutions for Hard problems
tests/     β†’ JUnit test files for each solution
lib/       β†’ JUnit and Hamcrest libraries

πŸ“ How to Run Tests Locally

  1. Compile solution and test files (from project root):
javac -cp ".;lib/*" Easy/YourSolution.java tests/Easy/YourSolutionTest.java
  1. Run the JUnit tests:
java -cp ".;lib/*" org.junit.runner.JUnitCore tests.Easy.YourSolutionTest

Replace YourSolution and YourSolutionTest with the actual file/class names.


πŸš€ Example

For the first problem, IntersectionOfTwoArraysII:

Compile:

javac -cp ".;lib/*" Easy/IntersectionOfTwoArraysII.java tests/Easy/IntersectionOfTwoArraysIITest.java

Run Test:

java -cp ".;lib/*" org.junit.runner.JUnitCore tests.Easy.IntersectionOfTwoArraysIITest

All tests should pass if the solution is correct.


✨ Contributing

  1. Add new solutions under the appropriate difficulty folder (Easy/, Medium/, Hard/).
  2. Add a matching JUnit test under tests/ with the same package structure.
  3. Commit and push your changes to keep the repo updated.

πŸ’‘ Notes

  • Each solution should be self-contained with proper class and method names.
  • Tests use JUnit 4. Make sure lib/junit-4.13.2.jar and lib/hamcrest-core-1.3.jar are present.
  • Keep naming consistent for readability and maintainability.

Happy coding! πŸš€

About

LeetCode Java Solutions with JUnit Tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages