Solutions for Leetcode problems in Python3.
This project is coded in Python 3 and managed with Makefile.
The test cases uses the default pytest
framework.
-
src/solutions
: will holds all your solutions. The code are in the same code format as the leetcode requires, so when you passed your own unit test cases, it can be directly copied and pasted on the leetcode OJ input box. It also holds the test cases for the solution. -
src/utils
: contains some of the utilities for the Leetcode solutions. -
Makefile
: You may runmake init
first to run the dependencies, and test your solutions withmake test
. Themake check
will check the code style first then runmake test
. It will runmake check
by default.
Source Code Layout
.
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.md
├── requirements.txt
├── setup.py
├── src
│ ├── __init__.py
│ ├── solutions
│ │ ├── __init__.py
│ │ ├── a0000blank.py
│ │ └── a0001twosum.py
│ └── utils
│ └── __init__.py
├── test_requirements.txt
└── tests
├── __init__.py
├── test_a0000blank.py
└── test_a0001twosum.py
-
Clone this project
git clone https://github.com/huajianmao/pyleet
-
Run
make init
to install the dependencies -
Choose a problem and create the
a00xxtitle.py
in thesrc/solutions
, and write your solution in this file. -
Create a test file
test_a00xxtitle.py
in thetests
, and write your test cases in this file. -
Test your solution with
make test
. -
Before you commit code, it would be better to run
make check
to check the code style.