* Project Euler problem 191 solution
* Add type hints and reference links
* Address requested changes
- update documentation
- split out helper function but mark it with an underscore
- remove redundant comments or make them more explicit/helpful
* Address requested changes
Name: Digit power sum
Problem Statement: The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284.
We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum.
You are given that a2 = 512 and a10 = 614656.
Find a30
Reference: https://projecteuler.net/problem=119
reference: #2695
Co-authored-by: Ravi Kandasamy Sundaram <rkandasamysundaram@luxoft.com>
* adding solution to problem 80
* updating DIRECTORY.md
* fixing spell check
* updating sol as per comments
* Add reference link to the problem
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* Add type hints and default args to problem 15
* Changes function's name to solution in problem 34
* Update sol1.py
* Update sol1.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* add problem url. Add typehint, default value and doctest
* run black
* add project url. add solution function for problem 35
* add space between imports on problem 35
* Update sol1.py
* Update sol1.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* added type hints and refactored the code a bit
* made output statement more explicit
* used f-strings and updated type hints
* modified solution function to return an integer solution
* updated docstring
* Update sol1.py
* Update sol2.py
Co-authored-by: Dhruv <dhruvmanila@gmail.com>
* test/graphs/kruskal: adding a test case to verify the correctness of the algorithm
Fixes#2128
* grahps/kruskal: running psf/black
* graphs/kruskal: read edges in a friendlier fashion
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update minimum_spanning_tree_kruskal.py
* fixup! Format Python code with psf/black push
* Update test_min_spanning_tree_kruskal.py
* updating DIRECTORY.md
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* 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>