Commit Graph

3012 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
d4c5b22424
[pre-commit.ci] pre-commit autoupdate (#8037)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/MarcoGorelli/auto-walrus: v0.2.1 → v0.2.2](https://github.com/MarcoGorelli/auto-walrus/compare/v0.2.1...v0.2.2)
- [github.com/PyCQA/isort: 5.10.1 → v5.11.3](https://github.com/PyCQA/isort/compare/5.10.1...v5.11.3)

* updating DIRECTORY.md

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-12-19 23:04:34 +01:00
Victor Rodrigues da Silva
3f8b2af14b
Add autoclave cipher (#8029)
* Add autoclave cipher

* Update autoclave with the given suggestions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixing errors

* Another fixes

* Update and rename autoclave.py to autokey.py

* Rename gaussian_naive_bayes.py to gaussian_naive_bayes.py.broken.txt

* Rename gradient_boosting_regressor.py to gradient_boosting_regressor.py.broken.txt

* Rename random_forest_classifier.py to random_forest_classifier.py.broken.txt

* Rename random_forest_regressor.py to random_forest_regressor.py.broken.txt

* Rename equal_loudness_filter.py to equal_loudness_filter.py.broken.txt

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-12-18 23:26:39 +01:00
Alexander Pantyukhin
30277f8590
add numbers different signs algorithm. (#8008) 2022-12-15 17:11:32 +13:00
Roberto Garcia
af8d520922
Update is_even.py (#8028) 2022-12-15 17:10:09 +13:00
pre-commit-ci[bot]
40f165b789
[pre-commit.ci] pre-commit autoupdate (#8026)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.10.0 → 22.12.0](https://github.com/psf/black/compare/22.10.0...22.12.0)
- [github.com/asottile/pyupgrade: v3.3.0 → v3.3.1](https://github.com/asottile/pyupgrade/compare/v3.3.0...v3.3.1)

* updating DIRECTORY.md

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-12-12 21:29:50 +01:00
Aaryan Raj
b25915adf9
Add algorithm to convert decimal number to its simplest fraction form (#8001)
* Added algorithm to convert decimal number to its simplest fraction form

* Apply suggested changes
2022-12-11 08:04:04 +01:00
pre-commit-ci[bot]
d141fa8838
[pre-commit.ci] pre-commit autoupdate (#8017)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v3.2.2 → v3.3.0](https://github.com/asottile/pyupgrade/compare/v3.2.2...v3.3.0)

* updating DIRECTORY.md

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-12-05 21:34:24 +01:00
Akshay Dubey
5654c6242e
algorithm: Hexagonal number (#8003)
* feat: Add hexagonal number

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-29 19:29:21 +01:00
Alexander Pantyukhin
6a86fe4867
Add backtrack word search in matrix (#8005)
* add backtracking word search

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* review notes fixes

* additional fixes

* add tests

* small cleanup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* small cleanup 2

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update backtracking/word_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update backtracking/word_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update backtracking/word_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update backtracking/word_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-29 19:28:47 +01:00
Alexander Pantyukhin
47bf3f58e0
fix validation condition and add tests (#7997)
* fix validation condition and add tests

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-29 19:07:27 +01:00
pre-commit-ci[bot]
361ddaf29e
[pre-commit.ci] pre-commit autoupdate (#8006)
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0)
- [github.com/PyCQA/flake8: 5.0.4 → 6.0.0](https://github.com/PyCQA/flake8/compare/5.0.4...6.0.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-29 21:55:30 +05:30
Christian Clauss
08c2245705
Upgrade to flake8 v6 (#8007)
* Upgrade to flake8 v6

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-29 16:56:41 +01:00
Mark Mayo
f32d611689
clean of unnecessary checks, imports, calls (#7993) 2022-11-21 00:00:27 +13:00
Alexander Pantyukhin
a25c53e8b0
Fix argument validation for count_1s_brian_kernighan_method (#7994)
* Fix argument validation for count_1s_brian_kernighan_method

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-20 23:59:25 +13:00
Swayam
f01a1af1df
Bi directional dijkstra (#7982)
* Added Bi-Directional Dijkstra

* Added Bi-Directional Dijkstra

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added doctest and type hints

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename Bi_directional_Dijkstra.py to bi_directional_dijkstra.py

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bi_directional_dijkstra.py

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update bi_directional_dijkstra.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-20 23:55:58 +13:00
Akshay Dubey
b33ea81a74
algorithm: Add juggler sequence (#7985)
* feat: Add juggler sequence

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor: Remove temp variable

* refactor: Change error type for negative numbers

* refactor: Remove # doctest: +NORMALIZE_WHITESPACE

* refactor: Remove int typecasting

* test: Add unit tests for n=10 and n=25

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-18 09:18:47 +01:00
pre-commit-ci[bot]
0684ccdd69
[pre-commit.ci] pre-commit autoupdate (#7983)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v3.2.0 → v3.2.2](https://github.com/asottile/pyupgrade/compare/v3.2.0...v3.2.2)
- [github.com/pre-commit/mirrors-mypy: v0.982 → v0.990](https://github.com/pre-commit/mirrors-mypy/compare/v0.982...v0.990)

* updating DIRECTORY.md

* Update .pre-commit-config.yaml

* Downgrade to mypy v0.991 --> v0.990

* mpyp v0.991

* Update DIRECTORY.md

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-15 18:34:17 +01:00
Dhruv Manilawala
8bfd1c844b
fix: mypy 0.991 issues (#7988)
* fix: mypy 0.991 issues

* fix: invalid condition for base case
2022-11-15 18:29:14 +01:00
Akshay Dubey
4ce8ad9ce6
algorithm: Liouville lambda function (#7986)
* feat: Add liouville lambda function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor: Refactor if-else block

* refactor: Refactor error handling for -ve numbers

* refactor: Remove # doctest: +NORMALIZE_WHITESPACE

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-15 18:28:49 +01:00
Dhruv Manilawala
3bf86b91e7
fix: no implicit optional (#7984) 2022-11-15 14:55:14 +01:00
Gayathri Krishnan
316e71b034
Additional intro blockchain doc (#7974)
* A deeper introduction to blockchain technology

* Update README.md

Rectified errors as image was not visible

* Delete img1.jpg

Deleting the image as it is not getting accepted in PR merge

* Delete img2.jpg

Deleting the image as it is not getting accepted in PR merge

* Update README.md

Removed all image s in the document

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update README.md

Commited the suggested changes and submitting for review.

* Update README.md

Changed a sentence that needed grammatical correction.

* Update README.md

Added the changes suggested by review panel

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-15 14:37:59 +01:00
Akshay Dubey
e1be882f72
algorithm: Twin prime (#7980)
* feat: Add twin prime algorithm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: Fix broken import statement

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-10 11:55:50 +01:00
Alexander Pantyukhin
7b2eca0243
add distribute coins (#7975)
* add distribute coins

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix review notes

* fix typehint

* fix type in TreeNode

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-10 15:49:38 +13:00
Christian Clauss
5c92b7390e
prime_numbers.py: Tighten up the benchmarks (#7976)
* prime_numbers.py: Tighten up the benchmarks

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-10 15:42:14 +13:00
Christian Clauss
4cddb26908
atbash.py: Tighten up the benchmarks (#7977)
* atbash.py: Tighten up the benchmarks

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-10 15:41:28 +13:00
Akshay Dubey
076193eefa
feat: Add pronic number implementation (#7979)
* feat: Add pronic number implementation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-10 15:39:47 +13:00
Akshay Dubey
3f9aae149d
feat: Add automorphic number implementation (#7978)
* feat: Add automorphic number implementation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor: Add type checking for number

* refactor: Rename variable n to number

* test: Add doctest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test: Add unit  test for number=0

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-09 16:36:38 +01:00
Abhishek Chakraborty
8951d857fe
BB84 QKD algorithm (#7898)
* Added BB84 algorithm.

* Function name lowercase + imports fix

I thought uppercase was appropriate because they're initials.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update quantum/bb84.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Removed python < 3.11 restriction from qiskit

* Removed python < 3.11 restriction from qiskit

* scikit-learn

* Update quantum/bb84.py

Correct typo in `default_rng()` call

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2022-11-08 18:24:21 +01:00
Christian Clauss
6aaf0a2c77
maths/number_of_digits.py: Streamline benchmarks (#7913)
* maths/number_of_digits.py: Streamline benchmarks

```
num_digits(262144): 6 -- 0.2226011250168085 seconds
num_digits_fast(262144): 6 -- 0.13145116699161008 seconds
num_digits_faster(262144): 6 -- 0.09273383300751448 seconds

num_digits(1125899906842624): 16 -- 0.6056742920191027 seconds
num_digits_fast(1125899906842624): 16 -- 0.15698366600554436 seconds
num_digits_faster(1125899906842624): 16 -- 0.1027024170034565 seconds

num_digits(1267650600228229401496703205376): 31 -- 1.1957934170495719 seconds
num_digits_fast(1267650600228229401496703205376): 31 -- 0.15552304196171463 seconds
num_digits_faster(1267650600228229401496703205376): 31 -- 0.13062308297958225 seconds
```

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update number_of_digits.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-08 11:49:47 +00:00
Caeden Perelli-Harris
daa1c7529a
Raise error not string (#7945)
* ci: Add `B023` to `.flake8` ignores

* refactor: Return `bool`/raise Exception

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert: Remove previous branch commit

* Update data_structures/binary_tree/segment_tree_other.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* feat: Apply `__repr__` changes

* chore: Fix failing tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/segment_tree_other.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* test: Fix doctests

* random.choice(population_score[:N_SELECTED])[0]

* Update basic_string.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-06 15:54:44 +01:00
Sanders Lin
51708530b6
Update 3n_plus_1.py (#7966)
* Update 3n_plus_1.py

1. Minor issue with ValueError message: Given integer should be positive, not greater than 1, as 1 is allowed.
2. += calls underlying list extend method which might be slower. Calling apend seems more appropriate.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-06 10:35:40 +01:00
Alexander Pantyukhin
7f1a5521f4
add prefix sum (#7959)
* add prefix sum

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-04 20:30:32 +13:00
Alexander Pantyukhin
3e1cb70abf
add algorithm to check binary search tree (#7947)
* add algorithm to check binary search tree

* add tests

* add leetcode link

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix typehints

* typehints fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix flake8

* fix typehint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add TreeNode resolving

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* change func name

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* review notes fixes.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix flake8

* fix flake 8

* fix doctest

* Update data_structures/binary_tree/is_bst.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-03 21:03:37 +01:00
Maxim Smolskiy
978414bd50
Reduce the complexity of other/graham_scan.py (#7953)
* Reduce the complexity of other/graham_scan.py

* Lower the --max-complexity threshold in the file .flake8

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix tests

* Update other/graham_scan.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update graham_scan.py

* Update other/graham_scan.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-02 23:56:30 +01:00
Maxim Smolskiy
a02de964d1
Reduce the complexity of graphs/minimum_spanning_tree_prims.py (#7952)
* Lower the --max-complexity threshold in the file .flake8

* Add test

* Reduce the complexity of graphs/minimum_spanning_tree_prims.py

* Remove backslashes

* Remove # noqa: E741

* Fix the flake8 E741 issues

* Refactor

* Fix
2022-11-02 22:16:44 +01:00
Maxim Smolskiy
db5215f60e
Reduce the complexity of linear_algebra/src/polynom_for_points.py (#7948)
* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Lower the --max-complexity threshold in the file .flake8

* Reduce the complexity of linear_algebra/src/polynom_for_points.py

* Update linear_algebra/src/polynom_for_points.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update linear_algebra/src/polynom_for_points.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Fix

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-02 19:40:25 +01:00
Christian Clauss
45b3383c39
Flake8: Drop ignore of issue A003 (#7949)
* Flake8: Drop ignore of issue A003

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-02 19:20:45 +01:00
Caeden Perelli-Harris
598f6a26a1
refactor: Condense password related files in one (#7939)
* refactor: Condense `password` related files in one

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update other/password.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* dynamic_programming

* test: Make test input `str`

* requirements.txt: Remove cython>=0.29.28  # For statsmodels on Python 3.11

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-02 17:20:57 +01:00
Alexander Pantyukhin
f05baa2b2b
add dp up - down minimum cost for tickets (#7934)
* add dp up - down minimum cost for tickets

* add typints

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add new tests and checks.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add more tests

* add types for the dp function

* Update dynamic_programming/minimum_tickets_cost.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* fix review notes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* small fix

* Update dynamic_programming/minimum_tickets_cost.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update dynamic_programming/minimum_tickets_cost.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix tests

* Update dynamic_programming/minimum_tickets_cost.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update dynamic_programming/minimum_tickets_cost.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-02 13:25:19 +01:00
Caeden Perelli-Harris
f512b4d105
refactor: Move pascals triange to maths/ (#7932)
* refactor: Move pascals triange to maths/

* Update xgboost_classifier.py

* statsmodels is now compatible with Python 3.11

* statsmodels is now compatible with Python 3.11

* cython>=0.29.28

* cython>=0.29.28  # For statsmodels on Python 3.11

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-01 20:25:39 +01:00
Alexander Pantyukhin
4e6c1c049d
Is power of two (#7936)
* add is power of two

* fix comment

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Deal with negative numbers

* Spelling: negative

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-11-01 18:43:03 +01:00
Christian Clauss
d23e709aea
maths/sum_of_digits.py: Streamline benchmarks (#7914)
* maths/sum_of_digits.py: Streamline benchmarks

```
sum_of_digits(262144): 19 -- 0.3128329170285724 seconds
sum_of_digits_recursion(262144): 19 -- 0.34008108399575576 seconds
sum_of_digits_compact(262144): 19 -- 0.6086010000435635 seconds

sum_of_digits(1125899906842624): 76 -- 0.8079068749793805 seconds
sum_of_digits_recursion(1125899906842624): 76 -- 0.8435653329943307 seconds
sum_of_digits_compact(1125899906842624): 76 -- 1.247976207989268 seconds

sum_of_digits(1267650600228229401496703205376): 115 -- 1.6441589999594726 seconds
sum_of_digits_recursion(1267650600228229401496703205376): 115 -- 1.713684624992311 seconds
sum_of_digits_compact(1267650600228229401496703205376): 115 -- 2.2197747920290567 seconds
```

* updating DIRECTORY.md

* Update sum_of_digits.py

* Update sum_of_digits.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-11-01 14:07:11 +01:00
Caeden Perelli-Harris
7d139ee7f1
refactor(abs): Condense abs_min and abs_max (#7881)
* refactor(abs): Condense `abs_min` and `abs_max`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-01 07:50:43 +01:00
Gustavobflh
74aa9efa1d
Added a Hubble Parameter calculator file (#7921) 2022-10-31 23:04:42 +01:00
Paradact
7addbccee7
Torus volume (#7905)
* Added Torus volume algorithm

* Updated Torus volume for simplicity (removed ref to vol_sphere())

* Refactoring

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-01 10:51:45 +13:00
Paradact
6c15f526e5
Added Torus surface area (#7906)
* Added Torus surface area

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed error in test

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-11-01 10:50:50 +13:00
pre-commit-ci[bot]
6cd7c49525
[pre-commit.ci] pre-commit autoupdate (#7920)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/asottile/pyupgrade: v3.1.0 → v3.2.0](https://github.com/asottile/pyupgrade/compare/v3.1.0...v3.2.0)

* updating DIRECTORY.md

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-31 21:33:08 +01:00
Kevin Joven
21601a4070
create quantum_fourier_transform (#6682)
* create quantum_fourier_transform

This is part of the #Hacktoberfest.
I build the quantum fourier transform for N qubits. (n = 3 in the example)
Best,
Kevin

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update q_fourier_transform.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add the doctest!

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update q_fourier_transform.py

* Pass first then fail

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-31 18:32:54 +01:00
Shriyans Gandhi
ded5deabe9
Dodecahedron surface area and volume (#6606)
* Hexagonal number sequence 

A hexagonal number sequence is a sequence of figurate numbers where the nth hexagonal number hₙ is the number of distinct dots in a pattern of dots consisting of the outlines of regular hexagons with sides up to n dots, when the hexagons are overlaid so that they share one vertex.

This program returns the hexagonal number sequence of n length.

* Update hexagonalnumbers.py

* Update hexagonalnumbers.py

* Update hexagonalnumbers.py

* Update hexagonalnumbers.py

* Update and rename hexagonalnumbers.py to hexagonal_numbers.py

* Length must be a positive integer

* Create dodecahedron.py

* Update dodecahedron.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dodecahedron.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dodecahedron.py

* Update dodecahedron.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update dodecahedron.py

* Update dodecahedron.py

* Apply suggestions from code review

Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

* Update dodecahedron.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
2022-10-31 18:15:37 +01:00
Shreyas Kamath
506b63f02d
Create convert_number_to_words.py (#6788)
* Create convert_number_to_words.py

A Python Program to convert numerical digits to English words. An Application of this can be in a Payment Application for confirmation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-31 18:04:42 +01:00