* Fix mypy errors for maths/greedy_coin_change.py
* Fix mypy errors for maths/two_sum.py
* Fix mypy errors for maths/triplet_sum.py
* Fix the format of maths/greedy_coin_change.py
* Fix the format of maths/greedy_coin_change.py
* Fix format with pre-commit
* Average mean refactor
Added doctests and type hints to average_mean
* Wiki link added
* Empty list check added
Empty list check added
Type hint changed to typing.List
A serious bug was addressed with this pull request. The mode function previously
didn't return the mode of the input list. Instead, it always returned the first value.
Due to lacking tests, the bug was never caught. This pull request also adds new
functionality to the function, allowing support for more than one mode.
See #4464 for details.
* * Mistake in average_mode.py fixed. The previous solution was to returnthe
value on the first loop iteration, which is not correct, more than that it
used to delete repeating values, so result's array and check array lost
relation between each other
* Type hint added
* redundant check_list deleted
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
* Suggestions resolved
* output typing changed to Any
* test cases added
* Black done
File formatted
* Unused statistics import
statistics only used in doctest, now they are imported in doctest
* Several modes support added
Several modes support added
* Comment fix
* Update maths/average_mode.py
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
* Suggestions added
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
This is a documentation fix. This fix patches a mistake in the description of the Armstrong number.
* * Doc fix
* Armstrong number is not the sum of cube's of number digits, but
the sum of number's digits each raised to the power of the number of digits
* Update armstrong_numbers.py
Line shorten
* Hacktoberfest: Add greedy_coin_change.py file
added the file in greedy_methods folder to implement the same method
Altered the code according to the changes that were requested.
* Added doctests.
doctests added to the function find_minimum_change.
* Added Greedy change file in Maths folder.
* updating DIRECTORY.md
* Deleted Greedy Method Folder
* updating DIRECTORY.md
* Update greedy_coin_change.py
* fix: black formatting issues
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
* Update area.py
Modified area of triangle function. Added a new algorithm to calculate area when 3 sides are known
* Add files via upload
* Update area.py
* Update area.py
* Update area.py
* Update area.py
* Remove unnecessary whitespace
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
* add type hints to math/gcd
* add doctest
* math/gcd - run black formatter
* math/gcd: remove manual doctest
* add correction to gcd of negative numbers
* add more doctest in iterative gcd
* Made improvements to combinations.py
* Update maths/combinations.py
Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
* Function now raises an error when given invalid input
* Update maths/combinations.py
Co-authored-by: Du Yuanchao <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>
* 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
* fix assignment of a variable to itself
* Fix unnecessary 'else' clause in loop
* formatting and redundant reasignment fix
* mark unreachable code with a TODO comment
* fix variable defined multiple times
* fix static method without static decorator
* revert unintended autoformatting
Co-authored-by: Christian Clauss <cclauss@me.com>
* revert autoformatting issue
* applied black autoformatting
Co-authored-by: Christian Clauss <cclauss@me.com>
* * support negative number
* add different version
* fixup! Format Python code with psf/black push
* sum(int(c) for c in str(abs(n)))
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* More efficient least common multiple.
* lowest -> least
* integer division
* Update least_common_multiple.py
Co-authored-by: Christian Clauss <cclauss@me.com>