Skip to main content

LeetPride makes for a beautiful problem solving and learning environment for test and timing data structures and algorithms. Happy Pride everyone and may the leet coding favor your fortune.

Project description

L e e t P r i d e

๐Ÿ’œ ๐Ÿ’™ ๐Ÿ ๐Ÿ’š ๐Ÿ’› ๐Ÿ“™ ๐ŸŽ

To make algorithm and data structure learning more exciting, colorful and enjoyable.

LeetPride interrogates the created classes and runs the tests specified to ensure success and optimize focus on problem-solving maximizing data structure an algorithm absorption, groking and satisfaction.

TreeNode and ListNode support with helper methods for easy test setup and printout of representations of trees and linked lists are now available.

One time Setup

>simply install with

pip install LeetPride

Screenshot of the 4 simple steps running in seconds. img

Happy Problem Solving and Happy Pride !!

Quickly get going on given any problem by simply creating a py file to begin coding solutions starting with import then common python boilerplate for generating and running tests on solutions.

There are 4 basic simple setups to get going in seconds. The last is the code you will write and generally goes first, followed by generate_tests() and then the main boilierplate runners. Also, there are capabilities to easily test and time multiple method implementations and different class method call sequencing for class testing.

  1. from LeetPride import run_process
    
  2. The standard main for running Class and Method solution tests is as follows:

    def main() -> int:
        return run_process(generate_tests())
    
    
    if __name__ == '__main__':
        exit(main())
    
  3. Multiple examples can be found in the /Examples folder of test generation simplicity and support for complex cases.

    Online gist example with screenshot of results for Daily LeetCode

    Example of required generate_tests() method using separate tests and expected results zipped together:

    def generate_tests():
        tests = (['Pride', 'loving', ],
                 [None,
                  'forever',
                  ])
        expected_test_results = [True, 'LGBTQ Lover forever !!!!', ]
        return list(zip(tests[0], tests[1], expected_test_results))
    
  4. For either -method- or -class- solutions:

    • A or B ( but supports mixing too even. )

    A. Class - class questions generally entail verifying output of sequenced method calls:

    class Pride:
        def __init__(self, always: bool = True):
            self.love = always
    
        def loving(self, equality: str = 'forever more') -> bool:
            return 'LGBTQ Lover ' + equality + ' !!!!' if self.love else 'Send Love'
    
      B. Method - general class Solution, so to align with LC practices:
    class Solution:
        # @timeit
        def method1(self, nums: List[int], target: int) -> List[int | None]:
            return [nums[target]]
    

All together for reference example:

pip install LeetPride

from LeetPride import run_process


class Pride:
    def __init__(self, always: bool = True):
        self.love = always

    def loving(self, equality: str = 'forever more') -> bool:
        return 'LGBTQ Lover ' + equality + ' !!!!' if self.love else 'Send Love'


def generate_tests():
    tests = (['Pride', 'loving', ],
             [None,
              'forever',
              ])
    expected_test_results = [True, 'LGBTQ Lover forever !!!!', ]
    return list(zip(tests[0], tests[1], expected_test_results))


def main() -> int:
    return run_process(generate_tests())


if __name__ == '__main__':
    exit(main())

Leet Code Daily N Queens II img

A few notes:

Instantiating the LeetCodeCore object takes an optional time_all bool parameter. -- If enabled to True, this will dynamically wrap any non @timeit wrapped methods designated for testing with a @timeit decorator and provide timing duration information detail.

Graphies are being cleaned up and will be included in very near term update.

Enjoy!
Tallicia

LeetPride depends on modules listed in requirements.txt

It is recommended to create a venv and install requirements.

   python3 -m venv venv
   ./venv/scripts/activate
   python3 -m pip install -U pip
   python3 -m pip install -r requirements.txt 

PURPLE HEART (๐Ÿ’œ): ๐Ÿ’œ BLUE HEART (๐Ÿ’™): ๐Ÿ’™ GREEN APPLE (๐Ÿ): ๐Ÿ GREEN HEART (๐Ÿ’š): ๐Ÿ’š YELLOW HEART (๐Ÿ’›): ๐Ÿ’› ORANGE BOOK (๐Ÿ“™): ๐Ÿ“™ RED APPLE (๐ŸŽ): ๐ŸŽ GREEN BOOK (๐Ÿ“—): ๐Ÿ“— BLUE BOOK (๐Ÿ“˜): ๐Ÿ“˜ LARGE RED CIRCLE (๐Ÿ”ด): ๐Ÿ”ด

๐Ÿ’œ ๐Ÿ’™ ๐Ÿ ๐Ÿ’š ๐Ÿ’› ๐Ÿ“™ ๐ŸŽ

L e e t P r i d e

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

LeetPride-0.6.9.2.6-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file LeetPride-0.6.9.2.6-py3-none-any.whl.

File metadata

  • Download URL: LeetPride-0.6.9.2.6-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for LeetPride-0.6.9.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 309bbf72261015ad670bee4856560f17ec191dedffce00e79f4b360feb20e592
MD5 94f74c4b346765b92f81f150a11cd2a4
BLAKE2b-256 8bd1df523de7d4f32243e969fafa1c75f8cd29c6d3d1a3ce7e1f9631be5740b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page