* 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
* Create exchange_sort.py
added exchange sort
* Fixed doctest in exchange_sort.py
* Fixed formatting error and added new length variable
added empty line at end of exchange_sort.py and turned len(numbers) into a variable
* Fixed formatting errors with black
added empty line
* case switch using python
* review comments
* added type hints
* general code format
* [mypy] Fix type annotations for secant_method.py
* remove bad push
* add phone_validator method
* change the phone_validator to indian_phone_validator
* Unnecessary comments removed
* all comments deleted
* Fixes: #{} new line issue
* code reformatted using black
* fixed colons and spaces
* fixed colons and spaces
* random anime character python script
* more tests passed
* type hint updated
Co-authored-by: Christian Clauss <cclauss@me.com>
* type hint updated again
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update random_anime_character.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Removes overuse of lambdas, improves readability and processing time when it finds bitstring to print out.
Removes overuse of lambdas, uses dictionary instead. This improves readability and processing time when it finds the bitstring to print out.
* Update huffman.py
* 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
* Luhn algorithm
Perform Luhn validation on input string
Algorithm:
* Double every other digit starting from 2nd last digit.
* Subtract 9 if number is greater than 9.
* Sum the numbers
https://en.wikipedia.org/wiki/Luhn_algorithm
* Update DIRECTORY.md
* Update luhn.py
* Update luhn.py
* Update luhn.py
* Update luhn.py
* Update DIRECTORY.md
* Remove redundent function
After reviewing this code, I've noticed that the `is_completed` function is a redundant operation.
Increasing the number of loops required for each step of the sudoku solver.
This should remove n² operations where n is the width of the grid.
* Update sudoku.py
Remove additional newline
* Added the matrix_exponentiation.py file in maths directory
* Implemented the requested changes
* Update matrix_exponentiation.py
* resolve merge conflict with upstream branch
* add new line at end of file
* add wavelet_tree
* fix isort issue
* updating DIRECTORY.md
* fix variable names in wavelet_tree and correct typo
* Add type hints and variable renaming
* Update data_structures/binary_tree/wavelet_tree.py
Add doctests to placate the algorithm-bot, thanks to @cclauss.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Move doctest to individual functions and reformat code
* Move common test array to the global scope and reuse in tests
* MMove test array to global scope and minor linting changes
* Correct the failing pytest tests
* MUse built-in list for type annotation
* Update wavelet_tree.py
* types-requests
* updating DIRECTORY.md
* Update wavelet_tree.py
* # type: ignore
* # type: ignore
* Update decrypt_caesar_with_chi_squared.py
* ,
* Update decrypt_caesar_with_chi_squared.py
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Aniruddha Bhattacharjee <aniruddha@Aniruddhas-MacBook-Air.local>
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
This is a different recursive implementation of the merge sort algorithm.
* Recursive Merge Sort That Accepts an Array
Recursive Merge Sort That Accepts an Array
* Add Wikipedia Link
* Fixes naming conventions
* Update sorts/recursive_mergesort_array.py
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
* Update sorts/recursive_mergesort_array.py
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
* Update sorts/recursive_mergesort_array.py
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
* Update sorts/recursive_mergesort_array.py
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
* Update sorts/recursive_mergesort_array.py
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
* Adds black format
* Removes unused variables
* Fixes variable names and adds documentation
* Fixes variable names to use snake_case.
* Removes double #.
* Update sorts/recursive_mergesort_array.py
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
Co-authored-by: Maxim R. <49735721+mrmaxguns@users.noreply.github.com>
Co-authored-by: Benjamin Fein <benfein78@icloud.com>