LeetCode Solutions - Python & Java
Table of Contents
What You'll Find:
This repository serves as a collaborative platform for our daily LeetCode problem-solving adventures!
What You'll Find:
- Python Solutions: Jupyter Notebooks containing your (username) solutions implemented in Python.
- Java Solutions: Separate Java files, each containing a solution to a specific LeetCode problem.
- Main File: A Java main file that can be used to run any of the Java solution files.
- Clear and concise explanations of problem statements, approaches, and code logic.
- Commented and well-formatted code adhering to best practices for readability and maintainability.
- Time and space complexity analysis of solutions using Big O notation.
- Test cases to validate code correctness under various input scenarios.
- Additional notes, insights, or alternative solutions discovered during the problem-solving process.
How to Use:
Run Java Solutions:
- Open the Main Java file.
- Uncomment or modify the main method to specify a target solution
- Run the main file to execute the target solution.
- Or run maven tests to execute test cases.
Why Collaborate?
- Shared Learning: By sharing our solutions, we can learn from each other's approaches, strengthen problem-solving skills, and gain valuable insights.
- Structured Review: Jupyter Notebooks and separate Java files provide a structured format for documenting solutions, promoting efficient review and knowledge retention.
- Diverse Perspectives: Working in different languages allows us to explore various coding techniques and gain a more comprehensive understanding of problem-solving.
Wanna contribute
?
Looking Ahead:
- Visualizations: Consider incorporating data visualizations in the Jupyter Notebooks to illustrate complex algorithms or data structures.
- Time Tracking: Implement a system to record time spent on each problem for performance analysis.
- Code Optimization: We can continuously investigate ways to optimize code for efficiency and readability.
- Problem Categorization: Organizing problems by topic or difficulty level can facilitate targeted review and practice.
Feel free to contribute your solutions, insights, and improvements to this collaborative learning space!
Contributing to LeetCode Solutions Repository
Thank you for your interest in contributing to our LeetCode solutions repository! We appreciate your help in making this project more comprehensive and useful for everyone.
Authors
This project is currently maintained and contributed to by:
- Joseph Afriyie Attakorah (Java solutions)
- Abigail Woolley (Python solutions)
Table of Contents
Getting Started
Fork the Repository
- Fork this repository to your GitHub account by clicking the "Fork" button at the top right of this page.
- Clone the forked repository to your local machine using:
git clone https://github.com/your-username/repo-name.git
- Navigate to the project directory:
cd repo-name
Set Up Your Local Environment
Ensure that you have the necessary tools installed to run the LeetCode solutions in your language of choice.
-
Python: Set up a virtual environment and install required dependencies:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
-
Java: Make sure you have JDK installed and set up on your system. You may use an IDE like IntelliJ IDEA, Eclipse, or VS Code with Java extensions.
How to Contribute
Adding a New Solution
-
Create a new branch:
git checkout -b feature/new-solution
-
Write the code:
- Follow the existing directory structure:
- Place Python solutions in the
python/
directory.
- Place Java solutions in the
java/
directory.
-
Add test cases:
- Include test cases in the same file (for simplicity) or in a dedicated
tests/
directory.
-
Commit your changes:
-
Push your branch:
git push origin feature/new-solution
-
Create a Pull Request:
- Go to the repository on GitHub, and you’ll see an option to create a Pull Request (PR).
- Fill in the PR template, including details about the problem solved, the approach used, and any other relevant information.
Updating an Existing Solution
- Follow the same steps as adding a new solution, but instead of creating a new file, modify the existing one.
- Clearly describe what changes you made and why in the commit message and PR description.
Code Style
-
Python:
- Use descriptive variable names.
- Add comments to explain the logic and steps in your code.
- Ensure your code is PEP8 compliant.
- Maintain consistency with existing Python code in the repository.
-
Java:
- Follow Java naming conventions (e.g.,
camelCase
for variables, PascalCase
for classes).
- Add comments to explain the logic and steps in your code.
- Ensure your code is formatted properly and follows the standard Java coding conventions.
Pull Request Process
- Ensure that your code passes all tests before submitting the PR.
- Fill out the PR template completely and accurately.
- Await review from project maintainers. They might request changes or provide feedback.
- Once your PR is approved, it will be merged into the main branch.
Issue Reporting
If you encounter any issues or bugs while using the repository, please feel free to open an issue on GitHub. Provide a detailed description of the issue, steps to reproduce it, and any relevant screenshots or logs.
Code of Conduct
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the repository maintainers.
Questions?
If you have any questions about contributing or need help, feel free to reach out by opening an issue or contacting the maintainers directly.