* add problem title and link, fix f-string
Signed-off-by: joan.rosellr <joan.rosellr@gmail.com>
* fix code style and improve doctests
Signed-off-by: joan.rosellr <joan.rosellr@gmail.com>
* undo changes to the main call
Signed-off-by: joan.rosellr <joan.rosellr@gmail.com>
* remove assignment operator in f-string
Signed-off-by: joan.rosellr <joan.rosellr@gmail.com>
* add newline after first import to attempt to fix pre-commit workflow
Signed-off-by: joan.rosellr <joan.rosellr@gmail.com>
* undo doctest changes, rename compute_pandigital_primes to solution
Signed-off-by: joan.rosellr <joan.rosellr@gmail.com>
* update solution to return the actual solution instead of a list
Signed-off-by: joan.rosellr <joan.rosellr@gmail.com>
* Update sol1.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* Fix: Multiple errors in fibonacci search.
- Test lists were not ordered, this is required for Fibonacci search
- Place documentation of function inside function
- Create multiple different tests including, float, char and negatives
- Add type hints in line with #2128
* Fix: sort of modules and delete typehint.
* Apply suggestions from code review
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* Correct invocation of lru_cache.
* Add check for input in fibonacci and doctest.
* Correct typehints to comply to numpy style.
* Correct ValueError to TypeError.
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* Correct doctest for TypeError.
* Rename single letter names as mentioned in CONTRIBUTING.md.
* Fix: Bug in big lists.
* Remove print(.) in doctests.
* Refactor iterator to while loop.
* Update searches/fibonacci_search.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* add typehints and docstrings
* add typehint and default value
* add typehint and default value. Removed unused variable.
* do not modifiy the given solution
* add doctests
* update sol1 after running black
* add typehint, docstring, and doctest
* update sol2 after running black
* add full problem statement and solution function with typehint and doctest
* renamed original function instead of adding new one
* don't alter original solution
* fix code style and update problem description with link
Signed-off-by: joan.rosellr <joan.rosellr@gmail.com>
* Update sol1.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* Added doomsday algorithm
* Adding unit-tests to doomsday algorithm
* running black on doomsday
* adding doctest and fixing a black issue [doomsday]
* Update doomsday.py
* fixing black issue [doomsday]
* Update other/doomsday.py
* Update doomsday.py
* adding more doctests (following review comment) [doomsday]
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Fix typehints in project_euler/problem01
Squashed commit of the following:
commit 6801d073b31bf702814861cd3b07b634ca295bfa
Author: Archaengel <god11341258@gmail.com>
Date: Mon Oct 5 16:40:10 2020 -0700
Fix typehints in project_euler/problem01
commit 29afc3af114abd1b99dc3f7c8fc99128229db131
Author: Archaengel <god11341258@gmail.com>
Date: Mon Oct 5 15:06:34 2020 -0700
Add typehints and default argument for project_euler/problem_01
* Add default args, typehints, and expand variable names for PE prob 02
* Add style improvements for first solution of PE Problem 02
* Add default arg and typehints for second solution of PE Problem 02
* Add default arg for third solution of PE Problem 02
* Add style improvements for 1st soln of PE problem 03
* Add default arg and typehints for 2nd soln of PE problem 03
* Add default arg for 3rd soln of PE problem 03
* Remove unnecessary newlines
* Remove unnecessary newlines
* Fix end of file for 2nd soln in PE problem 03
* Add style improvements to solutions for PE problem 04
* Restore original newlines in soln for PE problem 04
* Fix punctuation in docstring for PE problem 04
* Restore solution bodies for PE problem 04
* Expand variable names for 2nd soln of PE problem 04
- Add default arguments to solution function
- Add link to Project Euler problem 6
- Add doctest for testing `solution()`
- Removed test_solutions.py as it is redundant
* add typehints and docstrings
* add typehint and default value
* add typehint and default value. Removed unused variable.
* do not modifiy the given solution
* add doctests
* update sol1 after running black
* add typehint, docstring, and doctest
* update sol2 after running black
* Fix typehints in project_euler/problem01
Squashed commit of the following:
commit 6801d073b31bf702814861cd3b07b634ca295bfa
Author: Archaengel <god11341258@gmail.com>
Date: Mon Oct 5 16:40:10 2020 -0700
Fix typehints in project_euler/problem01
commit 29afc3af114abd1b99dc3f7c8fc99128229db131
Author: Archaengel <god11341258@gmail.com>
Date: Mon Oct 5 15:06:34 2020 -0700
Add typehints and default argument for project_euler/problem_01
* Add default args, typehints, and expand variable names for PE prob 02
* Add style improvements for first solution of PE Problem 02
* Add default arg and typehints for second solution of PE Problem 02
* Add default arg for third solution of PE Problem 02
* Add style improvements for 1st soln of PE problem 03
* Add default arg and typehints for 2nd soln of PE problem 03
* Add default arg for 3rd soln of PE problem 03
* Remove unnecessary newlines
* Remove unnecessary newlines
* Fix end of file for 2nd soln in PE problem 03
* chore: update print_reverse helper method
Use a generator expression instead of slicing
`elements_list` to improve the space and time complexity
of `make_linked_list` to O(1) space and O(n) time
by avoiding the creation a shallow copy of `elements_list`.
* fix: add type checking and argument typing
Add argument typing to all methods in `print_reverse`
Add doctest to helper function `make_linked_list` and
basic edge case tests to `print_reverse`
* test: add `print_reverse` test
Fix doctest syntax and remove edge case tests that are covered
by typed arguments.
Add `print_reverse` test that expects the correct values are printed
out by adding a `test_print_reverse_output` helper function.
* format code
Co-authored-by: shellhub <shellhub.me@gmail.com>
* Add GitHub action file for pre-commit
* Fix errors exposed by pre-commit hook:
- Remove executable bit from files without shebang. I checked those
file and it was not needed.
- Fix with black
* Apply suggestions from code review
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Add pre-commit basic config file
* Add pre-commit to requirements.txt
* Small tweaks and use stable for black
* Fix isort section in pre-commit-config file
* Fix errors and EOF only for Python files
* Fix all errors mentioned in pre-commit run:
- Fix end of file
- Remove trailing whitespace
- Fix files with black
- Fix imports with isort
* Fix errors
* Update sorts/quick_sort_3partition.py
Another quick sort algorithm, returns a new sorted list
* Update sorts/quick_sort_3_partition.py
rename quick_sort_3partition to quick_sort_3part
* Update sorts/quick_sort_3_partition.py
rename quick_sort_3part to three_way_radix_quicksort
Three-way radix quicksort:
https://en.wikipedia.org/wiki/Quicksort#Three-way_radix_quicksort
First divide the list into three parts.
Then recursively sort the "less than" and "greater than" partitions.
* Update sorts/quick_sort_3_partition.py
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Christian Clauss <cclauss@me.com>