Commit Graph

2703 Commits

Author SHA1 Message Date
Agniv Ghosh
47100b992a
Added code for palindrome partitioning problem under dynamic programming (#7222)
* Added code for palindrome partitioning problem under dynamic programming

* Updated return type for function

* Updated Line 24 according to suggestions

* Apply suggestions from code review

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

* Update palindrome_partitioning.py

* Update palindrome_partitioning.py

* is_palindromic

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-30 14:15:46 +01:00
Wissam Fawaz
d1430aa36b
Implemented a Pascal triangle generator (#7317)
* Added a Pascal triangle implementation to the other folder

* Added Pascal triangle implementation to the other folder.

* Added Pascal triangle implementation to the other folder.

* Added Pascal triangle implementation to the other folder.

* Implemented a Pascal triangle generator.

* Reversed Changes to DIRECTORY.md

* Reversed changed to .md files

* Update other/pascal_triangle.py

Removed personal info

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

* Update pascal_triangle.py

Expanded the description of the algorithm

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

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

* Printed output in triangular form

* Update CONTRIBUTING.md

Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 14:14:22 +01:00
Alexander Pantyukhin
cf915e7042
add Levinstein distance with Dynamic Programming: up -> down approach (#7171)
* add Levinstein distance with Dynamic Programming: up -> down approach

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

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

* add type hint

* fix flake8

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

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

* Update dynamic_programming/min_distance_up_bottom.py

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

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

* Update min_distance_up_bottom.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>
2022-10-30 14:00:16 +01:00
kumarsurajsk
2c65597093
addition_without_arithmetic (#6830)
* Addition_without_arithmetic

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

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

* added_param

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

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

* added_param_in_first_sec

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

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

* change_align

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

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

* Update Addition_without_arithmetic.py

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

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

* Rename Addition_without_arithmetic.py to addition_without_arithmetic.py

* Update addition_without_arithmetic.py

* Update addition_without_arithmetic.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-10-30 13:52:37 +01:00
Kushagra Makharia
69d04ff644
Added mean absolute error in linear regression (#7003)
* Added mean absolute error in linear regression

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

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

* Code feedback changes

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

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

* Apply suggestions from code review

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

* Apply suggestions from code review

* Update linear_regression.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>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-30 13:42:59 +01:00
sadiqebrahim
94b51f6a91
Added Builtin Voltage (#7850)
* Added Builtin Voltage

* Update builtin_voltage.py

* Update electronics/builtin_voltage.py

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

* Update electronics/builtin_voltage.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

* Apply suggestions from code review

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

* Create elf.py

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.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-10-30 12:52:20 +01:00
Jeremias Moreira Gomes
ab9d8f3874
Adding a Quine in Python. (#6807)
* Adding a Quine 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>
2022-10-30 12:09:23 +01:00
Lukas Esc
cafbbab125
shortened code using abs() and inplace ops (#7191)
n = -n if n < 0 else n --> n = abs(n)
n = n // 10 --> n //= 10
2022-10-30 11:56:54 +01:00
Dima I
9278d0c6cd
Added archimedes principle (physics) (#7143)
* Added archimedes principle (physics)

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

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

* reformated

* reformatted archimedes principles

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 11:54:23 +01:00
Emmanuel Bauma Murairi
b5d7f186f4
Polynomial (#6745)
* implement function to handle polynomial operations

* edit documentation

* fix type hint and linter errors

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

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

* fix short variable name

* fix spelling

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 11:52:50 +01:00
Pravin
cc42300780
Added Readme file to document the hashing algorithm. (#6743)
* Added Readme file to document the hashing algorithm.

* [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-30 11:50:08 +01:00
Micael Pereira
6b6d8cc111
Adding ELFHash Algorithm (#6731)
* Adding ELFHash Algorithm

Adding a new Hash Algorithm.

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

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

* Update elf.py

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

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

* Update elf.py

* Update elf.py

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

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

* Update elf.py

* Apply suggestions from code review

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
2022-10-30 11:49:22 +01:00
happiestbee
00fc53de97
added sumset.py Fixes: #{6563} (#6742)
* Create sumset.py

* updating DIRECTORY.md

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

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

* Add descriptive var names

* Update maths/sumset.py

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

* Update sumset.py

* updating DIRECTORY.md

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: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 11:49:05 +01:00
samyakpagariya
fcfe35c3d8
For the better understanding of time taken. (#6583)
* For the better understanding of time taken.

In this change I have initialized a variable p with the value of (1e9+7) and then took the modulus of process time with it . This modification gives better time taken by the process . Firstly it was giving answer in the exponential now it gives in the integer form.

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

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

* Apply suggestions from code review

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.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>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-30 11:43:41 +01:00
Kavienan J
b32903d22f
Add root mean square speed of gas molecules to physics (#6569)
* add rms speed of molecule to physics

* Update physics/rms_speed_of_molecule.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-30 11:29:00 +01:00
Kavienan J
c0b0b128b7
Add Ideal Gas Law for physics (#6503)
* add physics ideal gas law

* run pre commit

* Update physics/ideal_gas_law.py

Suggestion #1

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

* Update physics/ideal_gas_law.py

Suggestion #2

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

* run pre commit

* Update volume return line sugesstion

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

* Add suggestions

* Apply suggestions from code review

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

Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 11:26:46 +01:00
Si Lam
ca923389c0
Description of Double hasing (#6467)
* Description of DOuble hasing

* Fix sheebang

* Update double_hash.py

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

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

* Update double_hash.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>
2022-10-30 11:25:51 +01:00
Devesh Swarnkar
ba576a9a0b
Create README.md (#6642)
for blockchain file
2022-10-30 11:14:02 +01:00
Caeden Perelli-Harris
48a73a28d4
fix(quantum): Correct simulator deprecation (#7869) 2022-10-30 11:11:29 +01:00
Saksham1970
84facb78b2
Project Euler: 092 decreased the time (#6627)
* Added explanation and increased speed of the solution of problem 092

* updating DIRECTORY.md

* Added temporary fix to the failing of problem 104

* Reduced few seconds by minor improvements

* Update sol.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 11:10:16 +01:00
giladwo
00dfad9d20
Simplify climbing stairs and use constant memory (#6628)
* Simplify climbing stairs and use constant memory

* number_of_steps

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 10:59:10 +01:00
Kevin Joven
87a5d91976
quantum_teleportation.py (#6632)
* quantum_teleportation.py

This code is for the #Hacktoberfest.
This file run the quantum teleportation circuit using Qiskit.

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

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

* Update quantum/quantum_teleportation.py

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

* Update quantum/quantum_teleportation.py

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

* Update

Corrected some typos. 
Add more comments for adding the gates.
Update the variable qc with quantum_circuit in the simulator and execute.

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

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

* python return typehint solved.

* Fix long line

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-30 10:49:33 +01:00
Sushant Srivastav
5ba5c54858
Updated info (#7866)
* Updated info

Updated the readme section for sorts.

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

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

* Update sorts/README.md

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

* Update README.md

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-10-30 10:08:54 +01:00
Andrey
57ccabbaeb
Update docs (#7867)
* Update docs, remove unused excludes from pre-commit

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-30 10:01:58 +01:00
Carlos Villar
17d93cab78
Added Manhattan distance algorithm (#7790)
* Added Manhattan distance algorithm, Fixes: #7776

* Forgot that isinstance can accept a tuple

* Apply suggestions from code review

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

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

* Update manhattan_distance.py

* Update manhattan_distance.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>
2022-10-30 10:00:47 +01:00
lostybtw
f87de60b6d
fizzbuzz complete (#6504)
* fizzbuzz

* Update dynamic_programming/fizz_buzz.py

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

* Update dynamic_programming/fizz_buzz.py

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

* Update dynamic_programming/fizz_buzz.py

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

* Update dynamic_programming/fizz_buzz.py

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

* Update dynamic_programming/fizz_buzz.py

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

* added doctests and function to fizzbuzz

* Update fizz_buzz.py

* Update fizz_buzz.py

* Fixed FizzBuzz

* fizzbuzz passing test

* Update dynamic_programming/fizz_buzz.py

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

* Update dynamic_programming/fizz_buzz.py

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

* Update dynamic_programming/fizz_buzz.py

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

* Update dynamic_programming/fizz_buzz.py

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

* Update fizz_buzz.py

* Update fizz_buzz.py

* Update fizz_buzz.py

* fixed fizzbuzz

* Add files via upload

* added mechanical energy calculation

* Delete mechanical_energy.py

* Update fizz_buzz.py

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

Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 08:22:52 +01:00
ok-open-sc
0c5f1c0130
Increased Readability Of Variables (#6400)
* Increased Readability Of Variables

* Update anagrams.py

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

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

* Update anagrams.py

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

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

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-30 08:11:17 +01:00
Caio Cordeiro
f340bde6e0
Add simple neural network (#6452)
* feat: add simple foward propagation implementation

* fix: add PR requested changes

* feat: add code example

* fix: solve pre-commit failure

* feat: add doctest inside code execution

* fix: PR requested changes

* fix: pr requested changes

Co-authored-by: Caio Cordeiro <ccordeirodemorae@apple.com>
2022-10-30 08:05:44 +01:00
Itssxxsalman
2d3985006f
Fix grammatical mistakes in simple_keyword_cypher.py (#6385)
* Fixed grammitical mistake

* Update ciphers/simple_keyword_cypher.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-30 08:03:28 +01:00
Jason Devers
7b7b3dd086
matrix/count_paths.py (#7533)
* added recursive dfs backtracking for count paths with doctests

* fixed doc testing

* added type hints

* redefined r as row, c as col

* fixed naming conventions, ran mypy, only tests that didn't pass were using List[], rathan list()

* added another doctest, as well as a explanation above

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

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

* Update matrix/count_paths.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update matrix/count_paths.py

Co-authored-by: Chris O <46587501+ChrisO345@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

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

Co-authored-by: J <jasondevers@wireless-10-105-49-243.umd.edu>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-30 18:20:07 +13:00
SparshRastogi
3ec0aa85c0
Update kinetic_energy.py (#7848)
Fixed a typo error in docstrings
2022-10-29 23:24:59 +02:00
Andrey
1550731cb7
Remove file-level flake8 suppression (#7844)
* Remove file-level flake8 suppression

* updating DIRECTORY.md

* Fix tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-29 22:45:21 +02:00
Kushagra Makharia
47ddba1d91
Added cosine similarity (#7001)
* Added cosine similarity

* [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-29 17:38:40 +02:00
Shashank Kashyap
bd50a30682
Resonant Frequency & Electrical Impedance (#6983)
* Resonant Frequency

* Resonant Frequency of LC Circuit

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

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

* Update electronics/resonant_frequency.py

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

* Update electronics/resonant_frequency.py

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

* Update electronics/resonant_frequency.py

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

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

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

* Updated resonant_frequency.py

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

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

* Update electronics/resonant_frequency.py

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

* Fixed doctest issues in resonant_frequency.py

* Algorithm for Electrical Impedance

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

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

* Updated Algorithm for Electrical Impedance

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

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

* Update resonant_frequency.py

* Update electrical_impedance.py

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

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

* Update resonant_frequency.py

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

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

* Update electronics/electrical_impedance.py

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

* Update electronics/electrical_impedance.py

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

* Update electronics/resonant_frequency.py

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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Caeden <caedenperelliharris@gmail.com>
Co-authored-by: Paul <56065602+ZeroDayOwl@users.noreply.github.com>
2022-10-29 17:25:26 +02:00
dmorozov001
d84452344a
Correcting typos in CONTRIBUTING.md (#7845) 2022-10-29 16:43:03 +02:00
Harsh Verma
a02e7a1331
Added algorithm for Text Justification in Strings (#7354)
* Added algorithm for Text Justification in Strings

* Added algorithm for Text Justification in Strings
2022-10-29 15:54:32 +02:00
sadiqebrahim
038f8a00e5
add electric conductivity algorithm (#7449)
* add electric conductivity algorithm

* Update electric_conductivity.py

* Apply suggestions from code review

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

* Update electric_conductivity.py

* Update electric_conductivity.py

* Update electric_conductivity.py

* add algorithm

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-29 15:52:19 +02:00
Carlos Villar
7b521b66cf
Add Viterbi algorithm (#7509)
* Added Viterbi algorithm Fixes: #7465

Squashed commits

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

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

* Added doctest for validators

* moved all extracted functions to the main function

* Forgot a type hint

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-29 15:44:18 +02:00
Anshraj Shrivastava
efb4a3aee8
added algo for finding permutations of an array (#7614)
* Add files via upload

* Delete permutations.cpython-310.pyc

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

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

* Update permutations.py

* Update permutations.py

* Add files via upload

* Delete permutations.py

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

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

* Update permutations.py

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

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

* Update permutations.py

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

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

* Update permutations.py

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

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

* Update data_structures/arrays/permutations.py

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

* Update permutations.py

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

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

* Update permutations.py

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

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

* Update data_structures/arrays/permutations.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update permutations.py

* Update permutations.py

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

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

* Update permutations.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>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
2022-10-29 15:29:15 +02:00
JatinR05
93ad7db97f
Create recursive_approach_knapsack.py (#7587)
* Create recursive_approach_knapsack.py

Added a new naïve recursive approach to solve the knapsack problem.

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

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

* Update recursive_approach_knapsack.py

Updated the code

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

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

* Update recursive_approach_knapsack.py

Updated

* [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-29 15:28:12 +02:00
Andrey
584e743422
Fix yesqa hook (#7843)
* fix yesqa hook

* Remove redundant noqa

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-29 15:07:02 +02:00
Pronoy Mandal
18ffc4dec8
Update password_generator.py (#7745)
* Update password_generator.py

1. Use secrets module instead of random for passwords as it gives a secure source of randomness
2. Add type annotations for functions
3. Replace ctbi (variable for the characters to be included) with a more meaningful and short name
4. Use integer division instead of obtaining the integer part of a division computing a floating point

* [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-29 14:54:13 +02:00
tarushirastogi
b0f68a0248
Create centripetal_force.py (#7778)
* Create centripetal_force.py

Centripetal force is the force acting on an object in curvilinear motion directed towards the axis of rotation or centre of curvature.

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

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

* Update centripetal_force.py

The value error should also handle negative values of the radius and using more descriptive names will be more beneficial for the users

* Update centripetal_force.py

Made some bug fixes

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: SparshRastogi <75373475+SparshRastogi@users.noreply.github.com>
2022-10-29 14:43:51 +02:00
Sineth Sankalpa
327c38d6f0
Srilankan phone number validation (#7706)
* Add is_srilankan_phone_number.py

* Update is_srilankan_phone_number.py
2022-10-29 14:40:14 +02:00
Andrey
6e809a25e3
Rename files (#7819) 2022-10-29 14:31:56 +02:00
Andrey
a9bd68d96e
Add running doctest to pytest default (#7840)
* Add default options for pytest

* updating DIRECTORY.md

* Move pytest settings to pyproject.toml

* Move coverage settings to the pyproject.toml

* Return --doctest-continue-on-failure to pytest

* Convert pytest args to list

* Update pyproject.toml

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-29 14:27:47 +02:00
SparshRastogi
301a520f03
Create potential_energy.py (#7666)
* Create potential_energy.py

Finding the gravitational potential energy of an object with reference to the earth, by taking its mass and height above the ground as input

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

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

* Update physics/potential_energy.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update physics/potential_energy.py

Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>

* Update physics/potential_energy.py

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

* Update physics/potential_energy.py

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

* Update physics/potential_energy.py

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

* Update physics/potential_energy.py

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

* Update physics/potential_energy.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

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-30 00:14:44 +13:00
Andrey
cf08d9f5e7
Format docs (#7821)
* Reformat docs for odd_even_sort.py

* Fix docstring formatting

* Apply suggestions from code review

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

Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-29 08:26:19 +02:00
Andrey
762afc086f
Update breadth_first_search_2.py (#7765)
* Cleanup the BFS

* Add both functions and timeit

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

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

* Add performace results as comment

* Update breadth_first_search_2.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-10-28 22:27:39 +02:00
Shubham Kondekar
fe5819c872
Create combination_sum_iv.py (#7672)
* Create combination_sum_iv.py

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

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

* Update dynamic_programming/combination_sum_iv.py

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

* Update dynamic_programming/combination_sum_iv.py

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

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

* Update combination_sum_iv.py

* Update combination_sum_iv.py

* Resolved PR Comments

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

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

* minor change, argument missing in function

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

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

* Update dynamic_programming/combination_sum_iv.py

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

* minor change

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-10-28 21:32:32 +02:00