Commit Graph

1790 Commits

Author SHA1 Message Date
spamegg
5f9be0a613
Add Python type hints and doctests to other/two_sum.py (#2467)
* Add Python type hints and doctests to other/two_sum.py

#2465

* Update other/two_sum.py

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

* Update other/two_sum.py

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

* Update two_sum.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-23 21:55:51 +02:00
Christian Clauss
9200a2e543
from __future__ import annotations (#2464)
* from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-23 13:30:13 +02:00
Dhruv
6e6a49d19f
Config Travis CI for two jobs (#2463)
* Testing Travis CI configuration for project Euler

* Fix: Installing mypy and pytest-cov for testing

* Remove unnecessary checks for project_euler job

* Removing branches section

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-23 13:24:32 +02: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
Abhinav Anand
718be54dbb
Update sol1.py (#2455) 2020-09-20 21:33:26 +02:00
Dhruv
ea0759dbaa
Create problem_54 in project Euler (#2451)
* Add solution and test files for project euler 54

* Update sol1.py

* updating DIRECTORY.md

* Fix: use proper path to open files

* Commit suggestions:

- Use list comprehension instead of map
- Sort imports using isort

* Changes made as suggested (simplified a lot):

- List and set comprehension instead of itemgetter
- Using enumerate as it's easy to read
- Divided into list of card values and set of card suit as set will
  remove all the duplicate values. So, no need for double indexing.
- Add test for testing multiple calls to five_high_straight function

* Add suggestions and simplified:

- Split generate_random_hands function into two:
  - First will generate a random hand
  - Second, which will be called, will return a generator object

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-20 13:52:13 +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
b05081a717
Update and rename bin_to_octal.py to binary_to_octal.py (#2449)
* Update and rename bin_to_octal.py to binary_to_octal.py

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-19 14:58:08 +08:00
mohammadreza490
b22596cd96
bin_to_octal (#2431)
* bin_to_octal

Converts binary values to the octal equivalent.

* Update bin_to_octal

* Update conversions/bin_to_octal

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

* Update conversions/bin_to_octal

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

* Update conversions/bin_to_octal

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

* Update conversions/bin_to_octal

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

* Rename bin_to_octal to bin_to_octal.py

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Du Yuanchao <shellhub.me@gmail.com>
2020-09-19 13:36:56 +08:00
Christian Clauss
697495b017
Fix copy / paste oversight (#2448) 2020-09-19 07:25:18 +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
kanthuc
ecac7b0973
Contains loops.py add (#2442)
* added an algorithm which checks a linked list for loops and returns true if one is found

* added doctests and clarified meaning of loop

* Define Node.__iter__()

* Update and rename has_loop.py to has_duplicate_data.py

* Update has_duplicate_data.py

* Update has_duplicate_data.py

* Update and rename has_duplicate_data.py to has_loop.py

* Update has_loop.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-18 22:53:50 +02:00
Du Yuanchao
dc415ec14a
Added double linear search recursion (#2445)
* double linear search recursion

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-18 09:55:02 +02:00
avych
0dea049f44
Added static type checking to polynom-for-points.py towards issue #2128 (#2335)
* Added static type checking to linear_algebra/src/polynom-for-points.py

* Fixed TravisCI errors

* Update polynom-for-points.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-18 08:37:49 +02:00
Du Yuanchao
2de2267319
Updated problem_06 in Project Euler (#2439)
* * rename variable
* fix type hint
* fix doctest

* added test function

* fixed import error

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-17 11:37:53 +02:00
poloso
86fb2991d5
Corrected filename and include static types (#2440)
* Corrected name and include static types

- The name of the file is now compliant with python naming conventions
- Add static type as stated in contributing guidelines

* Apply suggestions from code review

- Delete documentation line to run doctests
- Delete type hints for variables that comes from functions

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

* Add edge cases tests.

* print(f"{target} was {not_str}found in {sequence}")

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-17 09:41:10 +02:00
Ashley Jeji George
1ac75f4683
Create priority_queue_using_list.py (#2435)
* Create priority_queue_using_list.py

* Update priority_queue_using_list.py

* Update priority_queue_using_list.py

* Update priority_queue_using_list.py

* Maximum queue size is 100

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-16 18:42:53 +02:00
Du Yuanchao
cbbc43ba3a
Updated problem_04 in project_euler (#2427)
* Updated problem_04 in project_euler

* fixup! Format Python code with psf/black push

* That number is larger than our acceptable range.

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-14 22:33:08 +02:00
Hasenn
10aa214fcb
Docstrings and formatting improvements (#2418)
* Fix spelling in docstrings

* Improve comments and formatting

* Update print statement to reflect doctest change

* improve phrasing and apply black

* Update rat_in_maze.py

    This method is recursive starting from (i, j) and going in one of four directions:
    up, down, left, right.
    If a path is found to destination it returns True otherwise it returns False.

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-14 14:40:27 +02:00
Ashley Jeji George
799fde4c07
Update linear_search.py (#2422)
* Update linear_search.py

Python implementation of recursive linear search algorithm

* Update linear_search.py

Added different doctests
Added the parameter hints
Handled the exception

* Update linear_search.py

added parameter hints to linear_search

* Update linear_search.py

Both the functions return the index if the target is found and -1 if it is not found
The rec_linear_search raises an exception if there is an indexing problem
Made changes in the doc comments

* Update linear_search.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-14 12:44:46 +02:00
Santosh Mohan Rajkumar
4e5b730e85
recaptchaVerification (#2417)
* recaptchaVerification

* recaptchaVerification

* recaptchaVerification1

* recaptchaVerification2

* recaptchaVerification3

* recaptchaVerification4

* recaptchaVerificatio5

* recaptchaVerificatio5

* recaptchaVerificatio6

* drawOnVideoStreamOpenCV

* matrixInverseMCAmethod

* fixingImports

* recaptchaVerificationfixes

* recaptchaVerificationfixes

* recaptchaVerificationfixes

* recaptchaVerificationfixes

* recaptchaVerificationfixes1

* recaptchaVerificationfixes1

* authenticate = login = render = redirect = print

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 22:26:15 +02:00
Du Yuanchao
44b8cb0c81
Updated Stack (#2414)
* * Added type hints
* Added test
* Formated code

* updating DIRECTORY.md

* Update stack.py

* Test error conditions for pop, peek, and

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 13:56:03 +02:00
Du Yuanchao
d6bff5c133
Renamed files and fixed Doctest (#2421)
* * Renamed files
* Fiexed doctest

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-13 13:27:20 +02:00
Hasenn
20e98fcded
Fix some warnings from LGTM (#2420)
* fix assignment of a variable to itself

* Fix unnecessary 'else' clause in loop

* formatting and redundant reasignment fix

* mark unreachable code with a TODO comment

* fix variable defined multiple times

* fix static method without static decorator

* revert unintended autoformatting

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

* revert autoformatting issue

* applied black autoformatting

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-13 10:11:27 +02:00
Guillaume Rochedix
f754c0d31f
Jump search (#2415)
* jump_search: doctest, docstring, type hint, inputs

* jumpsearch.py: case number not found

* trailing whitespace jump search
2020-09-12 07:50:12 +02:00
Meysam
2e790ce4ca
file-transfer: writing tests and ensuring that all is going well (#2413)
* file-transfer: writing tests and ensuring that all is going well

* def send_file(filename: str = "mytext.txt", testing: bool = False) -> None:

* send_file(filename="mytext.txt", testing=True)

* Update send_file.py

* requirements.txt: lxml

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 23:13:43 +02:00
Santosh Mohan Rajkumar
c676956030
lxmlCovidDataFetch (#2416)
* lxmlCovidDataFetch

* lxmlCovidDataFetch1

* Update worldometers_covid_with_lxml.py

* Rename worldometers_covid_with_lxml.py to covid_stats_via_xpath.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 22:25:05 +02:00
Marcos Cannabrava
a191f89fe2
Fix Non Recursive Depth First Search (#2207)
* Fix Non Recursive Depth First Search

* Unindent docstring

* Reindent docstring by 1 space

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 16:23:26 +02:00
mohammadreza490
1b3fec3f1f
binary_to_decimal converter (#2400)
* Create binary_to_decimal

binary to decimal converter

* Update conversions/binary_to_decimal

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

* Update binary_to_decimal

* Update conversions/binary_to_decimal

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

* Update binary_to_decimal

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-11 06:16:43 +02:00
mohammadreza490
696cd47e15
octal_to_decimal converter (#2399)
* Create octal_to_decimal

octal to decimal converter

* Update octal_to_decimal

* Update conversions/octal_to_decimal

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-10 10:37:29 +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
Tanuj Dhiman
25946e4570
Update scoring_functions.py (#2291)
* Update scoring_functions.py

We can find accuracy by manually if we are not going to use sklearn library.

* Update scoring_functions.py

* Update machine_learning/scoring_functions.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-09 19:04:46 +02:00
NEERAJ ADITYANANTH POLAMPALLI
c0dcc556b3
Update triplet_sum.py (#2404) 2020-09-06 10:40:46 +02:00
NEERAJ ADITYANANTH POLAMPALLI
3b1c4f72ce
changed a typo (#2396) 2020-09-05 13:09:18 +02:00
mohammadreza490
1385e47c36
Create hexadecimal_to_decimal (#2393)
* Create hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>

* Update conversions/hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>

* Update conversions/hexadecimal_to_decimal

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

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

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

* Update hexadecimal_to_decimal

Added negative hexadecimal conversion to decimal number

* Update hexadecimal_to_decimal

* Update conversions/hexadecimal_to_decimal

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

* Update conversions/hexadecimal_to_decimal

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

* Update hexadecimal_to_decimal

* Update hexadecimal_to_decimal

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-09-04 15:48:44 +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
Shubham Shaswat
a1d1a44f51
added idf-smooth (#2174)
* added idf-smooth

* added idf-smooth

* added idf-smooth
2020-09-02 19:33:12 +02:00
Muskan Kumar
e92e433dbe
Update CONTRIBUTING.md (#2378)
* Update CONTRIBUTING.md

fixed dead link to the license

* Update README.md

Added License

* Update README.md

* Update README.md

* Update README.md

* Update CONTRIBUTING.md

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-31 21:34:44 +02:00
小么小儿郎EL
80daa5750a
Fix bugs and add related tests (#2375) 2020-08-31 18:55:56 +02:00
kanthuc
472f63eaa5
Adding type hints to RedBlackTree (#2371)
* redblacktree type hints

* fixed type hints to pass flake8
2020-08-30 21:22:36 +02:00
Björn Olsson Jarl
8c191f1fc9
Added type hints for maths/fibonacci_sequence_recursion. (#2372) 2020-08-30 10:51:45 +02:00
Björn Olsson Jarl
ab5a046581
Added type hints and doctest for maths/prime_check. (#2367)
* Added type hints and doctest for maths/prime_check.

* Removed doctests.
2020-08-29 17:11:02 +02:00
Kushagra Bansal
f2f0425357
Created ugly_numbers.py in Python/maths (#2366)
* Add files via upload

* Update ugly_numbers.py

* Update ugly_numbers.py

* Update ugly_numbers.py
2020-08-29 16:57:34 +02:00
Aanuoluwapo Babajide
1f5134b368
Create alternate_disjoint_set.py (#2302)
* Create alternate_disjoint_set.py

This code implements a disjoint set using Lists 
with added heuristics for efficiency
Union by Rank Heuristic and Path Compression

* Update alternate_disjoint_set.py

Added typehints, doctests and some suggested variable name change

* Update alternate_disjoint_set.py

* Formatted with Black

* More formatting

* Formatting on line 28

* Error in Doctest

* Doctest Update in alternate disjoint set

* Fixed build error

* Fixed doctest
2020-08-28 18:25:02 +02:00
Kushagra Bansal
5ef784331e
Created triplet_sum in Python/other (#2362)
* Add files via upload

* Update triplet_sum.py

* Update triplet_sum.py

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update triplet_sum.py

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

* Update other/triplet_sum.py

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

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-28 15:50:35 +02:00
Kushagra Bansal
194b56d376
Created problem_63 in project_euler (#2357)
* Create __init__.py

* Add files via upload

* Update project_euler/problem_63/sol1.py

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

* Update sol1.py

* Update sol1.py

* Update sol1.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-27 13:40:03 +02:00
wuyudi
cf385ad7ef
Update merge_sort.py (#2356)
* Update merge_sort.py

* Update merge_sort.py
2020-08-27 09:45:03 +02:00
Firejay3
61dde44434
Added binery_or_operator.py to bit manipulation file (#2331)
* added bitwise binary OR operator

* Rename binary_OR_operator.py to binary_or_operator.py

* Update binary_or_operator.py

* Update binary_or_operator.py

* Update bit_manipulation/binary_or_operator.py

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

* Update binary_or_operator.py

* Update binary_or_operator.py

* Nice!!

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-27 09:09:42 +02:00
TrapinchO
30126c26dd
Added enigma machine emulator (#2345)
* Added Enigma machine file

Added Enigma machine file to 'ciphers' section

* Added doctest to validator

* Fixed typo

* Shortened some lines

* Shortened some lines

* Update enigma_machine.py

* Shortened some lines

* Update enigma_machine.py

* Update enigma_machine.py

* Update enigma_machine2.py

* Update enigma_machine2.py

* added f-strings

* Update enigma_machine2.py

* Update enigma_machine2.py

* Updated some numbers

* Plugboard improvement

Added option to separate pair for plugboard by spaces

* renamed variable

* renamed some variables

* improved plugboard exception

* Update enigma_machine2.py

* Update enigma_machine2.py
2020-08-26 21:52:17 +02:00
Kushagra Bansal
9aa10ca358
Created problem_55 in project_euler (#2354)
* Create __init__.py

* Add files via upload

* Update sol1.py
2020-08-26 13:31:13 +02:00