Commit Graph

2893 Commits

Author SHA1 Message Date
shricubed
44aa17fb86
Working binary insertion sort in Python (#8024) 2023-05-11 06:50:32 +12:00
Rohan Anand
209a59ee56
Update and_gate.py (#8690)
* Update and_gate.py

addressing issue #8656 by calling `test_and_gate()` , ensuring that all the assertions are verified before the actual output is printed.

* Update and_gate.py

addressing issue #8632
2023-05-10 21:38:52 +12:00
Pronoy Mandal
91cc3a240f
Update game_of_life.py (#8703)
Rectify spelling in docstring
2023-05-10 21:34:36 +12:00
Dipankar Mitra
7310514509
The ELU activation is added (#8699)
* tanh function been added

* tanh function been added

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

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

* tanh function is added

* tanh function is added

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

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

* tanh function added

* tanh function added

* tanh function is added

* Apply suggestions from code review

* ELU activation function is added

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

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

* elu activation is added

* ELU activation is added

* Update maths/elu_activation.py

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

* Exponential_linear_unit activation is added

* Exponential_linear_unit activation is added

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-05-02 16:36:28 +02:00
pre-commit-ci[bot]
777f966893
[pre-commit.ci] pre-commit autoupdate (#8704)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.262 → v0.0.263](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.262...v0.0.263)
- [github.com/tox-dev/pyproject-fmt: 0.10.0 → 0.11.1](https://github.com/tox-dev/pyproject-fmt/compare/0.10.0...0.11.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>
2023-05-01 23:48:56 +02:00
Himanshu Tomar
e966c5cc0f
Added minimum waiting time problem solution using greedy algorithm (#8701)
* Added minimum waiting time problem solution using greedy algorithm

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

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

* ruff --fix

* Add type hints

* Added two more doc test

* Removed unnecessary comments

* updated type hints

* Updated the code as per the code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-05-01 12:23:03 +02:00
Christian Clauss
f6df26bf0f
Fix docstring in present_value.py (#8702)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-05-01 06:29:42 +05:30
Sahil Goel
c4dcc44dd4
Added an algorithm to calculate the present value of cash flows (#8700)
* Added an algorithm to calculate the present value of cash flows

* added doctest and reference

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

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

* Resolving deprecation issues with typing module

* Fixing argument type checks and adding doctest case

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

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

* Fixing failing doctest case by requiring less precision due to floating point inprecision

* Updating return type

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

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

* Added test cases for more coverage

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

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

* Make improvements based on Rohan's suggestions

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

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

* Update financial/present_value.py

Committed first suggestion

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

* Update financial/present_value.py

Committed second suggestion

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

* Update financial/present_value.py

Committed third suggestion

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-04-30 19:33:22 +02:00
Christian Clauss
4c1f876567
Solving the Top k most frequent words problem using a max-heap (#8685)
* Solving the `Top k most frequent words` problem using a max-heap

* Mentioning Python standard library solution in `Top k most frequent words` docstring

* ruff --fix .

* updating DIRECTORY.md

---------

Co-authored-by: Amos Paribocci <aparibocci@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-27 23:02:07 +05:30
Dipankar Mitra
c1b3ea5355
The tanh activation function is added (#8689)
* tanh function been added

* tanh function been added

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

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

* tanh function is added

* tanh function is added

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

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

* tanh function added

* tanh function added

* tanh function is added

* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-04-25 18:06:14 +02:00
pre-commit-ci[bot]
a650426350
[pre-commit.ci] pre-commit autoupdate (#8691)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.261 → v0.0.262](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.261...v0.0.262)
- [github.com/tox-dev/pyproject-fmt: 0.9.2 → 0.10.0](https://github.com/tox-dev/pyproject-fmt/compare/0.9.2...0.10.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>
2023-04-25 06:05:45 +02:00
Rohan Anand
bf30b18192
Update linear_discriminant_analysis.py and rsa_cipher.py (#8680)
* Update rsa_cipher.py by replacing %s with {}

* Update rsa_cipher.py

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

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

* Update linear_discriminant_analysis.py

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

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

* Update linear_discriminant_analysis.py

* Update linear_discriminant_analysis.py

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

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

* Update linear_discriminant_analysis.py

* Update linear_discriminant_analysis.py

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

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

* Update linear_discriminant_analysis.py

* Update machine_learning/linear_discriminant_analysis.py

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

* Update linear_discriminant_analysis.py

* updated

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-04-24 07:28:30 +02:00
JulianStiebler
11582943a5
Create maths/pi_generator.py (#8666)
* Create pi_generator.py

* Update pi_generator.py

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

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

* Update pi_generator.py

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

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

* Update pi_generator.py

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

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

* Update pi_generator.py

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

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

* Update pi_generator.py

* Update pi_generator.py

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

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

* Updated commentary on line 28, added math.pi comparison & math.isclose() test

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

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

* Removed  # noqa: E501

* printf() added as recommended by cclaus

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-18 11:57:48 +02:00
Rohan Anand
458debc237
added a problem with solution on sliding window. (#8566)
* added a problem with solution on sliding window.

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

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

* added hint for return type and parameter

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

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

* Update minimum_size_subarray_sum.py

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

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

* Update minimum_size_subarray_sum.py

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

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

* Update minimum_size_subarray_sum.py

* Update minimum_size_subarray_sum.py

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

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

* Update minimum_size_subarray_sum.py

* removed un-necessary docs and added 2 test cases

* Rename sliding_window/minimum_size_subarray_sum.py to dynamic_programming/minimum_size_subarray_sum.py

* Update minimum_size_subarray_sum.py

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

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

* Update minimum_size_subarray_sum.py

* Update minimum_size_subarray_sum.py

* Update minimum_size_subarray_sum.py

* Update minimum_size_subarray_sum.py

* Update minimum_size_subarray_sum.py

* Update minimum_size_subarray_sum.py

* Update dynamic_programming/minimum_size_subarray_sum.py

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

* Update dynamic_programming/minimum_size_subarray_sum.py

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

* Update dynamic_programming/minimum_size_subarray_sum.py

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

* Update dynamic_programming/minimum_size_subarray_sum.py

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

* Update dynamic_programming/minimum_size_subarray_sum.py

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

* Update dynamic_programming/minimum_size_subarray_sum.py

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

* Update dynamic_programming/minimum_size_subarray_sum.py

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

* Update minimum_size_subarray_sum.py

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

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

* Fix

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

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

* Update minimum_size_subarray_sum.py

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

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

* Update minimum_size_subarray_sum.py

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

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

* Update minimum_size_subarray_sum.py

* Update minimum_size_subarray_sum.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>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-04-18 10:02:20 +02:00
Rohan Anand
93ce8cb75d
added reference link. (#8667)
* added reference link.

* [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>
2023-04-18 09:44:06 +02:00
Rohan Anand
b5047cfa11
Create apparent_power.py (#8664)
* Create apparent_power.py

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

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

* Update apparent_power.py

* Update apparent_power.py

* Update apparent_power.py

* Update electronics/apparent_power.py

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

* Update electronics/apparent_power.py

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

* Update apparent_power.py

* Update electronics/apparent_power.py

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

* Update apparent_power.py

* Update apparent_power.py

* Update apparent_power.py

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

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

* Update apparent_power.py

* Update apparent_power.py

* Update apparent_power.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>
2023-04-18 09:30:01 +02:00
Rohan Anand
2b051a2de4
Create real_and_reactive_power.py (#8665) 2023-04-18 10:17:48 +12:00
Diego Gasco
54dedf844a
Dimensionality reduction (#8590) 2023-04-17 10:34:22 +12:00
pre-commit-ci[bot]
d182f95646
[pre-commit.ci] pre-commit autoupdate (#8634)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.260 → v0.0.261](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.260...v0.0.261)
- [github.com/pre-commit/mirrors-mypy: v1.1.1 → v1.2.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.1.1...v1.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>
2023-04-10 23:43:17 +02:00
isidroas
14bdd174bb
Bloom Filter (#8615)
* Bloom filter with tests

* has functions constant

* fix type

* isort

* passing ruff

* type hints

* type hints

* from fail to erro

* captital leter

* type hints requested by boot

* descriptive name for m

* more descriptibe arguments II

* moved movies_test to doctest

* commented doctest

* removed test_probability

* estimated error

* added types

* again hash_

* Update data_structures/hashing/bloom_filter.py

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

* from b to bloom

* Update data_structures/hashing/bloom_filter.py

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

* Update data_structures/hashing/bloom_filter.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

* syntax error in dict comprehension

* from goodfather to godfather

* removed Interestellar

* forgot the last Godfather

* Revert "removed Interestellar"

This reverts commit 35fa5f5c4b.

* pretty dict

* Apply suggestions from code review

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

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

* Update bloom_filter.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>
2023-04-08 19:39:24 +02:00
Christian Clauss
2f9b03393c
Delete queue_on_two_stacks.py which duplicates queue_by_two_stacks.py (#8624)
* Delete queue_on_two_stacks.py which duplicates queue_by_two_stacks.py

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-08 17:46:19 +05:30
amirsoroush
5cb0a000c4
Queue implementation using two Stacks (#8617)
* Queue implementation using two Stacks

* fix typo in queue/queue_on_two_stacks.py

* add 'iterable' to queue_on_two_stacks initializer

* make queue_on_two_stacks.py generic class

* fix ruff-UP007 in queue_on_two_stacks.py

* enhance readability in queue_on_two_stacks.py

* Create queue_by_two_stacks.py

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-04-08 13:41:08 +02:00
Christian Clauss
179298e3a2
Revert "Add LeNet Implementation in PyTorch (#7070)" (#8621)
This reverts commit b2b8585e63.
2023-04-08 06:22:26 +05:30
Ishan Dutta
b2b8585e63
Add LeNet Implementation in PyTorch (#7070)
* add torch to requirements

* add lenet architecture in pytorch

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

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

* add type hints

* remove file

* add type hints

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

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

* update variable name

* add fail test

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

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

* add newline

* reformatting

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-04-07 17:51:25 +02:00
pre-commit-ci[bot]
740ecfb121
[pre-commit.ci] pre-commit autoupdate (#8611)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.259 → v0.0.260](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.259...v0.0.260)
- [github.com/psf/black: 23.1.0 → 23.3.0](https://github.com/psf/black/compare/23.1.0...23.3.0)
- [github.com/abravalheri/validate-pyproject: v0.12.1 → v0.12.2](https://github.com/abravalheri/validate-pyproject/compare/v0.12.1...v0.12.2)
---------

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>
2023-04-04 07:00:31 +05:30
Ishab
ebc2d5d79f
Add Project Euler problem 79 solution 1 (#8607)
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2023-04-02 17:34:11 +05:30
Christian Clauss
5ca7189563
Rename quantum_random.py.DISABLED.txt to quantum_random.py (#8601)
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-02 10:18:19 +05:30
Tianyi Zheng
33114f0272
Revamp md5.py (#8065)
* Add type hints to md5.py

* Rename some vars to snake case

* Specify functions imported from math

* Rename vars and functions to be more descriptive

* Make tests from test function into doctests

* Clarify more var names

* Refactor some MD5 code into preprocess function

* Simplify loop indices in get_block_words

* Add more detailed comments, docs, and doctests

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Add type hints to md5.py

* Rename some vars to snake case

* Specify functions imported from math

* Rename vars and functions to be more descriptive

* Make tests from test function into doctests

* Clarify more var names

* Refactor some MD5 code into preprocess function

* Simplify loop indices in get_block_words

* Add more detailed comments, docs, and doctests

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Convert str types to bytes

* Add tests comparing md5_me to hashlib's md5

* Replace line-break backslashes with parentheses

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-01 22:05:01 +02:00
Maxim Smolskiy
56a40eb3ee
Reenable files when TensorFlow supports the current Python (#8602)
* Remove python_version < "3.11" for tensorflow

* Reenable neural_network/input_data.py_tf

* updating DIRECTORY.md

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

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

* Try to fix ruff

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

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

* Try to fix ruff

* Try to fix ruff

* Try to fix ruff

* Try to fix pre-commit

* Try to fix

* Fix

* Fix

* Reenable dynamic_programming/k_means_clustering_tensorflow.py_tf

* updating DIRECTORY.md

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

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

* Try to fix ruff

---------

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>
2023-04-01 19:43:11 +02:00
Blake Reimer
84b6852de8
Graham's Law (#8162)
* grahams law

* doctest and type hints

* doctest formatting

* peer review updates
2023-04-01 18:43:07 +02:00
Tianyi Zheng
a213cea5f5
Fix mypy errors in dilation_operation.py (#8595)
* updating DIRECTORY.md

* Fix mypy errors in dilation_operation.py

* Rename functions to use snake case

* updating DIRECTORY.md

* updating DIRECTORY.md

* Replace raw file string with pathlib Path

* Update digital_image_processing/morphological_operations/dilation_operation.py

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

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-04-01 18:39:22 +02:00
Maxim Smolskiy
59cae167e0
Reduce the complexity of digital_image_processing/edge detection/canny.py (#8167)
* Reduce the complexity of digital_image_processing/edge_detection/canny.py

* Fix

* updating DIRECTORY.md

* updating DIRECTORY.md

* updating DIRECTORY.md

* Fix review issues

* Rename dst to destination

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-01 18:22:33 +02:00
amirsoroush
63710883c8
Remove extra len calls in doubly-linked-list's methods (#8600) 2023-04-01 17:53:21 +05:30
Maxim Smolskiy
3d2012c4ba
Add Project Euler problem 94 solution 1 (#8599)
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>
2023-04-01 17:50:08 +05:30
Maxim Smolskiy
d66e1e8732
Add Project Euler problem 800 solution 1 (#8567)
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>
2023-04-01 17:48:13 +05:30
Dhruv Manilawala
9e0c357a57
chore: additional Project Euler solution hash (#8593) 2023-04-01 08:29:26 +02:00
amirsoroush
e4d90e2d5b
change space complexity of linked list's __len__ from O(n) to O(1) (#8183) 2023-04-01 08:26:43 +02:00
Maxim Smolskiy
dc4f603dad
Add Project Euler problem 187 solution 1 (#8182)
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>
2023-04-01 11:17:24 +05:30
Tianyi Zheng
5ce63b5966
Fix mypy errors in lu_decomposition.py (attempt 2) (#8100)
* updating DIRECTORY.md

* Fix mypy errors in lu_decomposition.py

* Replace for-loops with comprehensions

* Add explanation of LU decomposition and extra doctests

Add an explanation of LU decomposition with conditions for when an LU
decomposition exists

Add extra doctests to handle each of the possible conditions for when a
decomposition exists/doesn't exist

* updating DIRECTORY.md

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-01 07:11:24 +02:00
NIKITA PANDEY
238fe8c494
Update receive_file.py (#8541)
* Update receive_file.py

Here are the changes I made:

Added the main() function and called it from if __name__ == "__main__" block. This makes it easier to test the code and import it into other programs.
Added socket.AF_INET as the first argument to socket.socket(). This specifies the address family to be used, which is necessary when using connect().
Changed print(f"{data = }") to print("Received:", len(data), "bytes"). This makes it clearer what's happening and how much data is being received.
Changed the final print statement to "Successfully received the file". This makes it more accurate and descriptive.
Moved the import statement to the top of the file. This is a common convention in Python.

* [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>
2023-03-31 16:08:13 +02:00
Rohan Anand
a00492911a
added a problem on kadane's algo and its solution. (#8569)
* added kadane's algorithm directory with one problem's solution.

* added type hints

* Rename kaadne_algorithm/max_product_subarray.py to dynamic_programming/max_product_subarray.py

* Update dynamic_programming/max_product_subarray.py

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

* Update max_product_subarray.py

* Update max_product_subarray.py

* Update dynamic_programming/max_product_subarray.py

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

* Update max_product_subarray.py

* Update max_product_subarray.py

* Update max_product_subarray.py

* Update max_product_subarray.py

* Update max_product_subarray.py

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

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

* Update max_product_subarray.py

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

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

* Update max_product_subarray.py

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

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

* Update max_product_subarray.py

* Update max_product_subarray.py

* Update dynamic_programming/max_product_subarray.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

* Update dynamic_programming/max_product_subarray.py

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

* Update max_product_subarray.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>
2023-03-31 13:17:13 +02:00
Rohan Anand
a71f22dae5
Update cnn_classification.py (#8570) 2023-03-30 07:09:21 +02:00
Maxim Smolskiy
ac111ee463
Reduce the complexity of graphs/bi_directional_dijkstra.py (#8165)
* Reduce the complexity of graphs/bi_directional_dijkstra.py

* Try to lower the --max-complexity threshold in the file .flake8

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

* updating DIRECTORY.md

* updating DIRECTORY.md

* Try to lower max-complexity

* Try to lower max-complexity

* Try to lower max-complexity

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-03-28 23:41:54 +02:00
Christian Veenhuis
86b2ab09aa
Fix broken links to Gitter Community (Fixes: #8197) (#8546)
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-03-26 18:20:47 +02:00
Genesis
7cdb011ba4
New gitter link added or replaced (#8551)
* New gitter link added

* ruff==0.0.258

* noqa: S310

* noqa: S310

* Update ruff.yml

* Add Ruff rule S311

* Ruff v0.0.259

* return ("{:08x}" * 5).format(*self.h)

* pickle.load(f)  # noqa: S301

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-03-26 17:19:18 +02:00
pre-commit-ci[bot]
3f9150c1b2
[pre-commit.ci] pre-commit autoupdate (#8294)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.255 → v0.0.257](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.255...v0.0.257)

* Fix PLR1711 Useless  statement at end of function

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2023-03-20 22:16:13 +01:00
Christian Clauss
521fbca61c
Replace flake8 with ruff (#8184) 2023-03-16 13:31:29 +01:00
Christian Clauss
c96241b5a5
Replace bandit, flake8, isort, and pyupgrade with ruff (#8178)
* Replace bandit, flake8, isort, and pyupgrade with ruff

* Comment on ruff rules

* updating DIRECTORY.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-03-15 13:58:25 +01:00
Maxim Smolskiy
adc3ccdabe
Add Project Euler problem 131 solution 1 (#8179)
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>
2023-03-15 18:26:03 +05:30
David Leal
47b3c72982
docs: add the other/miscellaneous form (#8163)
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2023-03-14 11:16:52 +05:30