Commit Graph

81 Commits

Author SHA1 Message Date
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
Snimerjot Singh
aebf9bdaaf
Added reverse_letters.py (#3730)
* Added reverse_letters.py

* Update strings/reverse_letters.py

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>

Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
2020-10-27 12:05:37 +08:00
Mayur Pardeshi
ed30749943
Added swap case program and removed unexpected expression part (#3212)
* Removed an extra '=' which was creating an error while running a program.

* Removed the unexpected expression part.

* Added program for swap cases in string folder

* removed if condition and exchange word with char

* added '=' sign which I removed before because of unknowing error from pycharm

* added space in test

* removed costraint from problem statement

* Update cocktail_shaker_sort.py

* Update naive_string_search.py

* Update swap_case.py

* psf/black " not '

* added new line at the end of the file

* Fix flake8 issues

* added new line at the end of the file

* added True and fixed comment

* python file end with \n

* Update swap_case.py

* Update strings/swap_case.py

* Update strings/swap_case.py

* Apply suggestions from code review

* Update strings/swap_case.py

* Update swap_case.py

* Update swap_case.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-15 00:19:00 +02:00
Dmytro Litvinov
000cedc07f
Add type hints for "strings" folder (#2882)
* Add type hints for strings/ folder

* Rerun other checks

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-10-06 14:01:15 +05:30
Eugeniy Orlov
2388bf4e17
Add type hints to strings/min_cost_string_conversion.py (#2337)
* done

* add types for local variables

* Revert "add types for local variables"

This reverts commit 971c15673b.

* rename variables

* Update strings/min_cost_string_conversion.py

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

* rename strings

* use flake8

* Update strings/min_cost_string_conversion.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-10-01 09:04:31 +08:00
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
Du Yuanchao
8904af98a1
Optimization for pangram string (#2473)
* optimization for pangram string

* fixup! Format Python code with psf/black push

* Update strings/check_pangram.py

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

* updating DIRECTORY.md

* Update strings/check_pangram.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-26 22:58:59 +08:00
Du Yuanchao
72fe611462
Updated lower and upper (#2468)
* update lower and upper

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-26 01:58:40 +08:00
Du Yuanchao
a196a36514
Fixed bugs (#2474)
* fixed bug

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-25 15:20:09 +02:00
Du Yuanchao
3a275caf01
Fixed remove duplicate (#2470)
* fixed remove duplicate

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-24 19:14:52 +08:00
Du Yuanchao
902fe1c907
Fixed reverse words algorithm (#2469)
* updated reversed words

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-24 19:12:52 +08:00
Du Yuanchao
a1ea76bcf3
Optimization problem_10 in project_euler (#2453)
* optimization for problem09 in project_euler

* added benchmark code

* fixup! Format Python code with psf/black push

* Update project_euler/problem_09/sol1.py

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

* updating DIRECTORY.md

* Update project_euler/problem_09/sol1.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-22 15:15:11 +02:00
Susmith98
9b73884def
Added a function that checks if given string can be rearranged to form a palindrome. (#2450)
* Added check_if_string_can_be_rearranged_as_palindrome function.

* Added counter implementation and benchmark function.

* flake changes

* Update and rename check_if_string_can_be_converted_to_palindrome.py to can_string_be_rearranged_as_palindrome.py

* Update can_string_be_rearranged_as_palindrome.py

* #

Co-authored-by: svedire <VedireSusmith_Reddy@intuit.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-19 21:49:37 +02:00
Christian Clauss
363858ef3b
hyphen_files = [file for file in filepaths if "-" in file] (#2447)
* hyphen_files = [file for file in filepaths if "-" in file]

* updating DIRECTORY.md

* Rename recursive-quick-sort.py to recursive_quick_sort.py

* updating DIRECTORY.md

* Rename aho-corasick.py to aho_corasick.py

* updating DIRECTORY.md

* Rename polynom-for-points.py to polynom_for_points.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-19 07:13:10 +02:00
Du Yuanchao
4d0a8f2355
Optimized recursive_bubble_sort (#2410)
* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-10 10:31:26 +02:00
mohammadreza490
c38dec091f
capitalize (#2389)
* Create capitalize.py

This function will capitalize the first character of a sentence or a word

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update strings/capitalize.py

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

* Update capitalize.py

* Update strings/capitalize.py

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

* Update capitalize.py

* Update capitalize.py

* Update capitalize.py

* Update strings/capitalize.py

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

* Update capitalize.py

* Update strings/capitalize.py

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

* Update capitalize.py

* Update capitalize.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-03 16:11:23 +02:00
Du Yuanchao
0591968947
Optimization and fix bug (#2342)
* * optimization aliquot_sum
* fix bug in average_median

* fixup! Format Python code with psf/black push

* Update maths/average_median.py

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-08-21 14:39:03 +08:00
Kushagra Bansal
2eca71663b
Created check_anagrams.py in strings (#2339)
* Add files via upload

* Update check_anagrams.py

* Update check_anagrams.py

* Update check_anagrams.py

* Update check_anagrams.py

* “” or not

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-19 18:24:02 +02:00
Nika Losaberidze
671e570c35
Implement prefix function, knuth-morris-pratt another usage (#2099)
* Implement prefix function, knuth-morris-pratt another usage

* fixup! Format Python code with psf/black push

* Fix style

* updating DIRECTORY.md

* Update prefix_function.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-17 18:27:05 +02:00
Christian Clauss
9316e7c014
Set the Python file maximum line length to 88 characters (#2122)
* flake8 --max-line-length=88

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-16 10:09:19 +02:00
Nika Losaberidze
8bb7b8f457
Fix syntax for flake8 passing (#2096)
* Fix syntax for flake8 passing

* fixup! Format Python code with psf/black push

* # fmt: off / # fmt: on

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-12 06:51:47 +02:00
Nika Losaberidze
2264244a34
Add Z-function algorithm implementation (#2067)
* Add Z-function algorithm implementation

* Spelling correction

* Reference url correction

* Add additional function as an example of z-function usage, change docstrings for functions

* Fix flake8 errors

* Update z_function.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-11 19:43:05 +02:00
mateuszz0000
3de6f010c3
Refactor remove duplicates to more pythonic (#2093)
* Refactor strings/remove_duplicate to more pythonic

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-11 06:13:40 +02:00
mateuszz0000
1a254465e3
Naive string doctests + typehints (#2054)
* Added doctests

* Added __main__

* Commit suggestion

* Undo changes to keep only doctests and typehints

* Reundo function name with params

* Update naive_string_search.py

* Update naive_string_search.py

* Update naive_string_search.py

* Update naive_string_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-01 15:40:40 +02:00
Christian Clauss
1e8fe8efcf
circular_linked_list: Add more len() tests (#2051)
* circular_linked_list: Add more len() tests

* fixup! Format Python code with psf/black push

* prepend()

* updating DIRECTORY.md

* Fix decrementation of self.length

* Add empty list tests

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-31 13:06:57 +05:30
mateuszz0000
3357768fc3
Jaro winkler (#2041)
* Added jaro_winkler first version

* Added doctests

* Fix flake warnings

* Refactor

* Fixes bug in jaro winkler implementation

* Commit suggestions

* Missing comming suggestions

* Remove unused math module

* Import doctest

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-05-31 00:14:55 +05:30
Ashwin Das
d8a4faf96d
Update is_palindrome.py (#2025)
* Update is_palindrome.py

* Update is_palindrome.py

* Reuse s

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-22 11:57:23 +02:00
Christian Clauss
1f8a21d727
Tighten up psf/black and flake8 (#2024)
* Tighten up psf/black and flake8

* Fix some tests

* Fix some E741

* Fix some E741

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-22 08:10:11 +02:00
Arkadip Bhattacharya
098be3594b
fix: space count in strings/word_occurrence.py (#1896)
* fix: space count in strings/word_occurrence.py

* Update strings/word_occurrence.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update strings/word_occurrence.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update strings/word_occurrence.py

Co-Authored-By: Christian Clauss <cclauss@me.com>

* Update word_occurrence.py

Seems like, there is no need o `occurrence.pop('', None)`

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-21 17:28:54 +02:00
Muhammad Umer Farooq
4b78c6952d
Create is_palindrome.py (#1754)
* Create is_palindrome.py

* Update is_palindrome.py

* Update is_palindrome.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-04-19 22:05:36 +05:30
Joaquin Cabezas
c1a57e0353
Fix typo "panagram" -> "pangram" (#1836) 2020-04-07 14:08:11 +02:00
Christian Clauss
3d129a4964
Create Python/quantum/README.md (#1834)
* Create Python/quantum/README.md

Started at #1831

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-04-07 11:58:23 +02:00
farnswj1
20c2db0de4
Update reverse_words.py (#1825)
The following update results in less lines of code and faster performance while preserving functionality.
2020-04-04 07:01:37 +02:00
Nolan Emirot
9b376a5bfb
Typo in comment rabin_karp.py (#1820)
* Update rabin_karp.py

fix: typo

* Update rabin_karp.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-03-29 10:19:19 +02:00