Skip to content

Latest commit

 

History

History
70 lines (55 loc) · 12.6 KB

README.md

File metadata and controls

70 lines (55 loc) · 12.6 KB

Run with Docker

To run all tests without cloning repository you can use docker (install before usage) with following command:

docker pull apostl/leetcode-solutions:latest

Then run pulled image:

docker run apostl/leetcode-solutions:latest

Expected result

After running the image you will see the result of running all tests in console:

============================= test session starts ==============================
platform linux -- Python 3.10.8, pytest-7.2.0, pluggy-1.0.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /app, configfile: pytest.ini
collecting ... collected 170 items

.....

============================= 170 passed in 2.00s ==============================

Listing containers must show 0 containers running:

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES

But in list of all containers you can see 1 container:

$ docker ps -a
CONTAINER ID   IMAGE                              COMMAND        CREATED          STATUS                     PORTS     NAMES
9d2438f4c558   apostl/leetcode-solutions:latest   "pytest -vv"   11 seconds ago   Exited (0) 7 seconds ago             frosty_bartik

Python Solutions for LeetCode

Title Solution Complexity Best Tries
217 Contains Duplicate Python Time: O(n)
Space: O(1)
Runtime: 475 ms, faster than 91.62%
Memory Usage: 25.9 MB, less than 67.10%
69 Sqrt(x) Python Time: O(log(n))
Space: O(1)
Runtime: 33 ms, faster than 97.69%
Memory Usage: 13.7 MB, less than 95.90%
14 Longest Common Prefix Python Time: O(n)
Space: O(1)
Runtime: 33 ms, faster than 96.61%
Memory Usage: 13.9 MB, less than 88.41%
2095 Delete the Middle Node of a Linked List Python Time: O(n)
Space: O(1)
Runtime: 1778 ms, faster than 97.45%
Memory Usage: 59.1 MB, less than 98.65%
24 Swap Nodes in Pairs Python Time: O(n)
Space: O(1)
Runtime: 31 ms, faster than 95.39%
Memory Usage: 13.8 MB, less than 97.39%
328 Odd Even Linked List Python Time: O(n)
Space: O(1)
Runtime: 47 ms, faster than 91.67%
Memory Usage: 16.5 MB, less than 98.89%
1721 Swapping Nodes in a Linked List Python Time: O(n)
Space: O(1)
Runtime: 951 ms, faster than 99.55%
Memory Usage: 48.3 MB, less than 95.97%
1019 Next Greater Node In Linked List Python Time: O(n)
Space: O(n)
Runtime: 324 ms, faster than 93.52%
Memory Usage: 18.8 MB, less than 86.93%
382 Linked List Random Node Python Time: O(n)
Space: O(1)
Runtime: 98 ms, faster than 84.89%
Memory Usage: 17.1 MB, less than 96.85%
445 Add Two Numbers II Python Time: O(n)
Space: O(n)
Runtime: 69 ms, faster than 95.16%
Memory Usage: 13.7 MB, less than 99.45%
817 Linked List Components Python Time: O(n)
Space: O(n)
Runtime: 113 ms, faster than 93.74%
Memory Usage: 19.1 MB, less than 60.86%
725 Split Linked List in Parts Python Time: O(n)
Space: O(n)
Runtime: 30 ms, faster than 99.83%
Memory Usage: 14.1 MB, less than 99.67%
61 Rotate List Python Time: O(n)
Space: O(1)
Runtime: 28 ms, faster than 99.75%
Memory Usage: 13.8 MB, less than 98.91%
2058 Find the Minimum and Maximum Number of Nodes Between Critical Points Python Time: O(n)
Space: O(n)
Runtime: 1015 ms, faster than 96.30%
Memory Usage: 54 MB, less than 97.69%
148 Sort List Python Time: O(nlog(n))
Space: O(1)
Runtime: 669 ms, faster than 87.44%
Memory Usage: 36.4 MB, less than 90.87%
2074 Reverse Nodes in Even Length Groups Python Time: O(kn)
Space: O(1)
Runtime: 2293 ms, faster than 88.36%
Memory Usage: 53.5 MB, less than 93.65%
86 Partition List Python Time: O(n)
Space: O(1)
Runtime: 32 ms, faster than 97.52%
Memory Usage: 13.5 MB, less than 99.97%
143 Reorder List Python Time: O(n)
Space: O(1)
Runtime: 91 ms, faster than 94.85%
Memory Usage: 23.8 MB, less than 95.63%
138 Copy List with Random Pointer Python Time: O(n)
Space: O(n)
Runtime: 24 ms, faster than 99.98%
Memory Usage: 14.8 MB, less than 83.62%
147 Insertion Sort List Python Time: O(n^2)
Space: O(1)
Runtime: 941 ms, faster than 53.66%
Memory Usage: 16.5 MB, less than 81.87%