Commit Graph

114 Commits

Author SHA1 Message Date
SwayamSahu
71c7c0bd35
Updated a typo in print statement (#7696)
* Updated a typo in print statement

* Apply suggestions from code review

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-26 22:20:00 +02:00
M3talM0nk3y
68f6e9ac30
Added function that checks if a string is an isogram (#7608)
* Added function that checks if a string is an isogram.

* Added wiki reference and fixed comments.

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

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

* Made function name more self-documenting. Raise ValueError if string contains 1 or more digits. Renamed file. Lowercase string inside function.

* Removed check_isogram.py (file renamed).

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

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

* Fixed test failure.

* Raise ValueError when string has non-alpha characters. Removed import.

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-26 16:31:16 +13:00
Carlos Villar
d8ab8a0a0e
Add Spain National ID validator (#7574) (#7575)
* Add Spain National ID validator (#7574)

* is_spain_national_id()

* Update is_spain_national_id.py

* Some systems add a dash

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-24 13:33:56 +02:00
Christian Clauss
b8b63469ef
My favorite palindrome (#7455)
* My favorite palindrome

* updating DIRECTORY.md

* Update is_palindrome.py

* Update is_palindrome.py

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

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

* Update strings/is_palindrome.py

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

* Update is_palindrome.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>
Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
2022-10-23 18:12:49 +02:00
SwayamSahu
0dc95c0a6b
Update comments in check_pangram.py script (#7564)
* Update comments in check_pangram.py script

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

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

* Update and rename check_pangram.py to is_pangram.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-23 18:00:59 +02:00
Sagar Giri
e7b6d2824a
Change to https. (#7277)
* Change to https.

* Revert the py_tf file.
2022-10-16 09:43:29 +02:00
Caeden
a652905b60
Add Flake8 comprehensions to pre-commit (#7235)
* ci(pre-commit): Add ``flake8-comprehensions`` to ``pre-commit`` (#7233)

* refactor: Fix ``flake8-comprehensions`` errors

* fix: Replace `map` with generator (#7233)

* fix: Cast `range` objects to `list`
2022-10-15 19:29:42 +02:00
Caeden
6e69181d1f
refactor: Replace list() and dict() calls with literals (#7198) 2022-10-15 06:37:03 +05:30
Caeden
d5a9f649b8
Add flake8-builtins to pre-commit and fix errors (#7105)
Ignore `A003`

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: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-13 19:53:59 +05:30
Carlos Villar
6118b05f0e
Convert snake_case to camelCase or PascalCase (#7028) (#7034)
* Added snake_case to Camel or Pascal case Fixes: #7028

* Added suggested changes

* Add ending empty line from suggestion

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

* Update strings/snake_case_to_camel_pascal_case.py

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

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: Christian Clauss <cclauss@me.com>
2022-10-13 08:24:53 +02:00
Abinash Satapathy
1aa7bd9616
Added barcode_validator.py (#6771)
* Update README.md

Added Google Cirq references

* Create barcode_validator.py

Barcode/EAN validator

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

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

* Update barcode_validator.py

Included docstring and updated variables to snake_case

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

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

* Update barcode_validator.py

Included docset and updated bugs

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

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

* Update barcode_validator.py

Implemented the changes asked in review.

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

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

* Update barcode_validator.py

Updated with f-string format

* Update barcode_validator.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-13 00:56:10 +02:00
Caeden
07e991d553
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038)

* refactor: Fix naming conventions (#7038)

* Update arithmetic_analysis/lu_decomposition.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

* refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038)

* chore: Fix naming conventions in doctests (#7038)

* fix: Temporarily disable project euler problem 104 (#7069)

* chore: Fix naming conventions in doctests (#7038)

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-13 00:54:20 +02:00
Beksultan
5754bd09ff
fix typo (#6375) 2022-09-21 16:37:38 +01:00
Margaret
cbf3c6140a
add the dna algorithm (#6323)
* adding the dna algorithm

* following bot recommendations

following bot recommendations for the indentation

* following bot recommendations

following bot recommendations regarding indentation [ again ]

* following bot recommendations

following bot recommendations regarding indentation [ again. ]

* following bot recommendations

following bot recommendations.
2022-09-05 02:51:11 +01:00
Vardhaman
2d5dd6f132
MAINT: Updated f-string method (#6230)
* MAINT: Used f-string method

Updated the code with f-string methods wherever required for a better and cleaner understanding of the code.

* Updated files with f-string method

* Update rsa_key_generator.py

* Update rsa_key_generator.py

* Update elgamal_key_generator.py

* Update lru_cache.py

I don't think this change is efficient but it might tackle the error as the error was due to using long character lines.

* Update lru_cache.py

* Update lru_cache.py

Co-authored-by: cyai <seriesscar@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-07-07 16:34:07 +02:00
John Law
9135a1f411
Fix doctests and builds in various files (#6233)
* Fix doctest in hamming distance

* add line break

* try to fix quantum_riper_adder

* fix floating point build
2022-07-06 10:00:05 +02:00
Sedat Aybars Nazlica
89fc7bf0b0
Add hamming distance (#6194)
* Add hamming distance

* Fix doctest

* Refactor

* Raise ValueError when string lengths are different
2022-07-06 15:19:13 +08:00
Margaret
04bc8f01dd
Wave (#6061)
* Added censor function

* Added censor code

* Added comments to the code

* modified censor function

* added decrypt function

* added cypher and decypher functions, deleted censor and decrypt functions

* Deleted decrypt.py

* Deleted censor.py

* edited the crypt and decrypt files

* Update cypher_txt.py

* Remove the endline in cypher.py

* Removed the print at the end of decypher.py

* added 4 new algorithms

* added tests to the four files

* added type hints for the function variables

* Deleted decode message

* Deleted code message

* Welford average algorithm

* added average welford algorithm

* is_narcissistic added

* added a descriptive name

* added max_sectors algorithm

* added find_unique

* added wave algorithm

* deleting average_welford [ in the wrong pr ]

* deleting is_narcissistic [ is in the wrong pr ]

* deleting max_sectors [ is in the wrong pr ]

* deleting find_unique [ is in the wrong pr ]

* deleting censor [ is in the wrong pr ]

* deleting decrypt [ is in the wrong pr ]

* fixed wave.py 

fixed indentation and followed the bots reccomendations

* fixed wave.py again

* fixing wave.py for the third time.

* fixing wave.py

* merging strings/wave.py

merging the suggestion

Co-authored-by: John Law <johnlaw.po@gmail.com>

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-06-24 00:47:29 +08:00
Ikko Ashimine
dceb30aad6
Fix typo in word_occurrence.py (#6154)
word_occurence -> word_occurrence
2022-05-20 12:03:54 +08:00
Rohan R Bharadwaj
e95ecfaf27
Add missing type annotations for strings directory (#5817)
* Type annotations for `strings/autocomplete_using_trie.py`

* Update autocomplete_using_trie.py

* Update detecting_english_programmatically.py

* Update detecting_english_programmatically.py

* Update frequency_finder.py

* Update frequency_finder.py

* Update frequency_finder.py

* Update word_occurrence.py

* Update frequency_finder.py

* Update z_function.py

* Update z_function.py

* Update frequency_finder.py
2022-05-13 13:55:53 +08:00
Shuangchi He
e1ec661d4e
Fix some typos (#6113)
* Fix some typos.

* Update volume.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-01 18:44:23 +08:00
Harshit Agarwal
1f1daaf1c7
feat: add strings/ngram algorithm (#6074)
* feat: added ngram algorithm
* fix(test): use `math.isclose` to match floating point numbers approximately

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-04-04 09:06:32 +05:30
Leoriem-code
4c9949f636
edited strings/anagram.py (#5770)
* rewrote anagrams.py, added doctests

* corrected mistakes

* add anagrams.txt

* Update anagrams.py

* Update strings/anagrams.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-08 18:58:15 +01:00
Rohan R Bharadwaj
99cf2cc1c5
Fix build issues due to count (#5725)
* Fix build issues due to count

* Update check_anagrams.py
2021-10-31 22:56:33 +01:00
Morteza
9ac94c09eb
Improve checking anagrams in O(n) with dictionary (#4806) 2021-10-31 11:41:39 +01:00
@im_8055
a94c6214ff
Fix spellings (#5710) 2021-10-31 11:36:03 +01:00
Navpreet Singh Devpuri
21c99d2ae2
added is_contains_unique_chars() (#5701)
* added is_contains_unique_chars()

* added is_contains_unique_chars()

* added stackoverflow reference
2021-10-30 22:04:46 +02:00
Christian Clauss
366a0f1839
Fix validate_initial_digits of credit_card_validator.py (#5600)
* Fix validate_initial_digits of credit_card_validator.py

@Bhargavishnu I think that I broke the logic of validate_initial_digits which should require that credit_card_number[0] is 3 before checking that credit_card_number[1] is 4, 5, or 7.  Please verify the new changes and the new test cases to make sure that this is correct.  Thanks!

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-26 14:32:34 +02:00
@im_8055
12e81ea6a2
Add credit card string validator (#5583)
* Add credit card validator

* 

* Add return type hint

* Add test cases for validator function

* Add test cases

* Feature: Rename file

* Update strings/cc_validator.py

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

* Update strings/cc_validator.py

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

* Update strings/cc_validator.py

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

* Review: Fix redundant checks

* Review: Refactor

* Fix: Update test cases

* Refactor

* Update credit_card_validator.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-26 07:21:07 +02:00
Mohammad Firmansyah
74e442e979
add an algorithm to spin some words (#5597)
* add an algorithm to spin some words

* Update index.py

* Adding type hint of spin_words function

* Update and rename python_codewars_disemvowel/index.py to strings/reverse_long_words.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-25 19:18:41 +02:00
Rohan R Bharadwaj
2ddd81df21
Remove wrongly placed double qoutes (#5530)
* Update baconian_cipher.py

* Update join.py

* Updated type hint
2021-10-23 01:14:08 +08:00
Toki345
0ca1279997
Fixed grammar on Anagram Description (#5512)
Made the description more formal, also fixed a few grammatical issues.
2021-10-22 16:07:57 +02:00
P U N I T H
83cf5786cd
Add wildcard pattern matching using dynamic programming (#5334)
* Added regular expression implimentation using dp

* replaced input() with example values

* Apply suggestions from code review

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

* changed returning value to bool and added test cases

* added doctest

Co-authored-by: John Law <johnlaw.po@gmail.com>

* added test cases

* Apply suggestions from code review

Co-authored-by: John Law <johnlaw.po@gmail.com>

* shifted to strings

* Changed filename

* Update function name to match_pattern

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update function name to match_pattern

Co-authored-by: John Law <johnlaw.po@gmail.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-10-20 16:30:58 +08:00
Rohan R Bharadwaj
fa88559cab
Create join.py (#5363)
* Create join.py

Because we have a split.py

* Update join.py

* Update join.py

* Update join.py

* Update join.py

* Update join.py

* Update strings/join.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update join.py

* Update join.py

* Update join.py

* Update join.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-10-18 21:35:35 +08:00
Rohanrbharadwaj
97562c19f8
Added doctest (#5182) 2021-10-10 20:00:04 +02:00
Rohanrbharadwaj
7578e0b920
Used in-built method (#5183)
* Used in-built method

* Delete swap_case.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-10 19:52:38 +02:00
Sarvesh Kumar Dwivedi
90db98304e
Fix word typos in comments (#4928)
* fixed: spelling

nonegative -> non-negative

* fixed: spelling

transpostiion -> transposition

* fixed: spelling

topolical -> topological

* fixed: spelling

sufix -> suffix
2021-10-04 12:07:58 +08:00
Christian Clauss
cecf43d648
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
imp
5e7eed610c
[mypy] Fix type annotations for strings (#4641)
* Fix mypy error for min_cost_string_conversion.py

* Fix mypy error for manacher.py

* Fix mypy error for aho_corasick.py
2021-08-25 13:35:36 +02:00
imp
20a4fdf384
[mypy] Fix type annotations for strings (#4637)
* Fix mypy error for can_string_be_rearranged_as_pal

* Fix mypy error for levenshtein_distance.py

* Fix mypy error for word_patterns.py

* Fix mypy error for word_occurrence.py
2021-08-19 14:08:20 +02:00
Shubham Ganar
3c225247b8
[mypy] Fix type annotations for strings/naive_string_search.py (#4611) 2021-08-13 09:10:52 +02:00
SURYAPRATAP SINGH SURYAVANSHI
f432bc76a6
add alternative_string_arrange method (#4595)
* add alternative_string_arrange method

* fix issue

* fix one more issue

* changed the variable name li to output_list
2021-08-06 12:15:42 +02:00
SURYAPRATAP SINGH SURYAVANSHI
72aa4cc315
add phone_validator method (#4552)
* 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
2021-07-20 09:35:21 +02:00
ngxingyu
727341e3db
Create check_pangram.py (#4389) 2021-05-04 08:49:41 +02:00
Oliver Dewitz
cbe4d5f952
Fixed typo in docstring (#4326) 2021-04-12 13:40:10 +02:00
algobytewise
0ee8f792e3
Moved "other/anagrams.py" to the string folder (#4289)
* move&rename, changed code accordingly

* adjusted codespell ignore-list
2021-03-22 11:40:23 +01:00
algobytewise
99a42f2b58
Move files to strings folder (#4283)
* Move files to strings-folder

* moved the file "words" back to the original folder

* moved "anagram.py" also back

* fix the codespell ignore-list
2021-03-21 12:05:10 +01:00
CarsonHam
61f3119467
Change occurrences of str.format to f-strings (#4118)
* f-string update rsa_cipher.py

* f-string update rsa_key_generator.py

* f-string update burrows_wheeler.py

* f-string update non_recursive_segment_tree.py

* f-string update red_black_tree.py

* f-string update deque_doubly.py

* f-string update climbing_stairs.py

* f-string update iterating_through_submasks.py

* f-string update knn_sklearn.py

* f-string update 3n_plus_1.py

* f-string update quadratic_equations_complex_numbers.py

* f-string update nth_fibonacci_using_matrix_exponentiation.py

* f-string update sherman_morrison.py

* f-string update levenshtein_distance.py

* fix lines that were too long
2021-02-23 11:23:49 +05:30
Sethu
b31ed8c494
Modified comments on upper.py (#3884)
* Modified comments on upper.py ,made it more clean

* Update strings/upper.py

Co-authored-by: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com>

* Update upper.py

* Update upper.py

Co-authored-by: xcodz-dot <71920621+xcodz-dot@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-18 12:07:30 +05:30
Frank Schmitt
c0d88d7f71
Fix handling of non ascii characters in swap case (fixes: #3847) (#3848)
* #3847 fix handling of non-ASCII characters in swap_case

* #3847 remove unused regex

* Fix formatting (with black) Fixes: #3847

* Add type hints for `swap_case` function

Co-authored-by: Frank Schmitt <frankschmitt@gmx.de>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2020-11-06 22:39:12 +05:30