Commit Graph

116 Commits

Author SHA1 Message Date
Lakshay Akula
cb0a5480a7
Add catalan_numbers.py (#4455)
Reviewed by @mrmaxguns. This is an implementation of Catalan Numbers.
2021-05-31 19:55:01 -05: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
Kanak
677d48d6c0
Rename coin_change.py to minimum_coin_change.py (#4108) 2021-01-11 16:55:15 +05:30
Alex Joslin
e7ab06f5de
Implemented minimum steps to one using tabulation. (#3911)
* Implemented minimum steps to one using tabulation.

* Update minimum_steps_to_one.py

Made the parameter "n" more descriptive.  Changed it to number

* `n` to `number`

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-12-09 17:22:07 +08:00
Himadri Ganguly
46af42d47a
Fix coin change (#2571)
* Removed unused variable m.

* Doctests are modified to match functions.

* Added condition for negative values.

* Fixed white-space around operator.

* Fixed W293 blank line contains white-space error.

* Update dynamic_programming/coin_change.py

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

* Fixed error in code.

* Fixed whited spacing.

* Fixed PEP8 error.

* Added more test cases for coin change problem.

* Removed extra test for negetive value.

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>
2020-10-24 00:55:13 +08:00
Dhruv
48357cea5b
Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +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
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
Sanders Lin
f0d7879a11
fixed error in factorial.py (#1888)
* Update factorial.py

* updating DIRECTORY.md

* Update dynamic_programming/factorial.py

* Update factorial.py

Co-authored-by: mateuszz0000 <mtszzwdzk@gmail.com>
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2020-08-05 13:18:41 +02:00
Christian Clauss
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
Christian Clauss
cd3e8f95a0
isort --profile black --recursive . (#2170)
* isort --profile black --recursive .

* Update codespell.yml

* typo: vertices

* typo: Explanation

* typo: Explanation

* Fix typos
2020-07-06 08:48:18 +05:30
vinayak
2d3d660155
black fixes and Travis CI fixes (#2160)
* black format

* updating DIRECTORY.md

* fixes

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-02 20:02:15 +05:30
Tapajyoti Bose
c534e77cb1
Added minimum cost path algorithm (#2135)
* Added maximum path sum for matrix (top left to bottom right)

* Changed maximum cost path to minimum cost path + added video explaination
2020-07-02 14:43:29 +05:30
Christian Clauss
fdc5bee7af
Euler problem 551 sol 1: Reduce McCabe code complexity (#2141)
* Euler problem 551 sol 1: Reduce McCabe code complexity

As discussed in #2128

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-06-22 14:16:12 +02:00
Tapajyoti Bose
23484efdad
Added maximum non-adjacent sum (#2130)
* Added maximum non-adjacent sum

* Bugfix: flake8 test

* Implemented changes (broke tuple unpacking into 2 lines due to flake8 tests)

* Implemented changes v2.0

* Update max_non_adjacent_sum.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-17 17:09:29 +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
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
Sanders Lin
777ddca2e9
Update fast_fibonacci.py (#1889)
* Update fast_fibonacci.py

* Update fast_fibonacci.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-05-19 19:31:52 +02:00
Christian Clauss
6acd7fb5ce
Wrap lines that go beyond GitHub Editor (#1925)
* Wrap lines that go beyond GiHub Editor

* flake8 --count --select=E501 --max-line-length=127

* updating DIRECTORY.md

* Update strassen_matrix_multiplication.py

* fixup! Format Python code with psf/black push

* Update decision_tree.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-05-01 23:36:35 +02:00
Sanders Lin
1c9d4a3929
Update abbreviation.py (#1887) 2020-04-17 20:04:30 +02:00
matkosoric
7f04e5cd34
contribution guidelines checks (#1787)
* spelling corrections

* review

* improved documentation, removed redundant variables, added testing

* added type hint

* camel case to snake case

* spelling fix

* review

* python --> Python # it is a brand name, not a snake

* explicit cast to int

* spaces in int list

* "!= None" to "is not None"

* Update comb_sort.py

* various spelling corrections in documentation & several variables naming conventions fix

* + char in file name

* import dependency - bug fix

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-03-04 13:40:28 +01:00
Christian Clauss
652b891a75
Travis CI: Upgrade to Python 3.8 (#1783)
* Travis CI: Upgrade to Python 3.8

* updating DIRECTORY.md

* Tensorflow is not yet compatible with Python 3.8

* Disable k_means_clustering_tensorflow.py

* updating DIRECTORY.md

* Disable gan.py

* updating DIRECTORY.md

* Disable input_data.py

* updating DIRECTORY.md

* pip install a current version of six
2020-02-23 04:23:00 +01:00
onlinejudge95
4866b1330b
Fixes black failures from Previous PR (#1751)
* Fixes black failures from Previous PR

* Fixes equality testing alert

* Fixes call to main() alert

* Fixes unused import
2020-02-13 02:19:41 +05:30
Jimmy Y
1096aa2336
Added DP Solution for Optimal BST Problem (#1740)
* Added code to dynamic_programming directory

* Added doctest

* Elaborated BST

* Small tweaks

* Update optimal_bst.py

* Some touchups

* Fixed doctest

* Update optimal_bst.py

* Update optimal_bst.py

* Update optimal_bst.py

* Rename optimal_bst.py to optimal_binary_search_tree.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-02-11 05:53:26 +01:00
onlinejudge95
6fdd53c676
Fixes LGTM issues (#1745)
* Fixes redefinition of a variable

* Fixes implementing __eq__

* Updates docstring
2020-02-10 22:23:19 +01:00
Christian Clauss
bfcb95b297
Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
Christian Clauss
28419cf839 pyupgrade --py37-plus **/*.py (#1654)
* pyupgrade --py37-plus **/*.py

* fixup! Format Python code with psf/black push
2020-01-03 22:25:36 +08:00
Christian Clauss
34c808b375 actions/checkout@v2 (#1643)
* actions/checkout@v2

https://github.com/actions/checkout/releases

* fixup! Format Python code with psf/black push
2019-12-26 19:50:12 +08:00
faizan2700
86dbf0a9d3 file iterating_through_submasks.py for given mask is added in dynamic_programming (#1635)
* new file *iterating_through_submasks* is added in dynamic_programming section

* no changes

* *iterating_through_submasks.py is added in dynamic_programming

* iterating_through_submasks is added with doctests

* iterating_through_submasks.py is added in dynamic_programming

* changes made in *iterating_through_submasks.py

* changes made in *iterating_through_submasks.py

* updated
2019-12-18 19:55:12 +05:30
Iqrar Agalosi Nureyza
1af4c02ba6 adding doctests on coin_change.py and fixed some typos (#1337)
* adding doctests on coin_change.py

* fixed some typos

* Update lib.py
2019-12-18 08:35:03 +01:00
GeorgeChambi
9eb50cc223 Improved readability (#1615)
* improved readability

* further readability improvements

* removed csv file and added f
2019-12-07 06:39:59 +01:00
Arun Babu PT
c5fd075f1e Fractional knapsack (#1524)
* Add files via upload

* Added doctests, type hints, f-strings, URLs

* Rename knapsack.py to fractional_knapsack.py

* Rename graphs/fractional_knapsack.py to dynamic_programming/fractional_knapsack_2.py
2019-11-22 22:55:19 +08:00
Christian Clauss
b838f1042c Fix indentation contains tabs (flake8 E101,W191) (#1573) 2019-11-15 23:05:00 -08:00
Christian Clauss
5df8aec66c
GitHub Action formats our code with psf/black (#1569)
* GitHub Action formats our code with psf/black

@poyea Your review please.

* fixup! Format Python code with psf/black push
2019-11-14 19:59:43 +01:00
John Law
a9d5378ce2
Doctest and typing for longest_increasing_subsequence.py (#1526)
* Update longest_increasing_subsequence.py

* Update longest_increasing_subsequence.py

* Format longest_increasing_subsequence.py to PEP8

* Update longest_increasing_subsequence.py
2019-11-05 02:06:16 +08:00
Taufik Algi F
c717f8d860 add max sum contigous subsequence (#1537)
* add max sum contigous subsequence

* fix typo

* Add doctest and type hints

* Create autoblack.yml
2019-10-31 18:45:01 +01:00
John Law
357dbd4ada
Doctest, type hints and bug in LIS_O(nlogn) (#1525)
* Update longest_increasing_subsequence_o(nlogn).py

* Update longest_increasing_subsequence_o(nlogn).py
2019-10-31 01:06:07 +08:00
John Law
1da1ab0773 Improve doctest and comment for maximum sub-array problem (#1503)
* Doctest and comment for maximum sub-array problem

More examples and description for max_sub_array.py

* Update max_sub_array.py

* Update max_sub_array.py

* Fix doctest
2019-10-28 17:44:57 +01:00
Ankur Chattopadhyay
7592cba417 psf/black code formatting (#1421)
* added sol3.py for problem_20

* added sol4.py for problem_06

* ran `black .` on `\Python`
2019-10-22 19:13:48 +02:00
Jigyasa G
ddb094919b Adding doctests for fractional_knapsack.py (#1331)
* Adding doctests for fractional_knapsack.py

* Update fractional_knapsack.py
2019-10-18 08:13:20 +02:00
Jigyasa G
67291a5bce Modified longest_common_ssubsequence.py for successful doctests (#1332) 2019-10-12 02:32:41 +08:00
Jigyasa G
e678879892 Adding doctests for sum_of_subset.py (#1333) 2019-10-12 02:29:50 +08:00
Jigyasa G
ea47ae2932 Adding missing Doctests (#1330)
* Adding doctests in abbreviation

* Adding doctests in fibonacci.py
2019-10-10 00:20:19 +05:00
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
Maxwell Aladago
2dfe01e4d8 Fully refactored the rod cutting module. (#1169)
* changing typo

* fully refactored the rod-cutting module

* more documentations

* rewording
2019-09-05 08:22:06 +02:00
Rwithik Manoj
d4151bd516 Fix possible error in longest_common_subsequence.py (#1163)
The comparison at line 53 was not checking if (j > 0).
2019-08-31 13:40:50 +02:00
Christian Clauss
47a9ea2b0b
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python

* sort() --> sorted()
2019-08-19 15:37:49 +02:00
Maxwell Aladago
32aa7ff081 ENH: refactored longest common subsequence, also fixed a bug with the sequence returned (#1142)
* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* some pep8 cleanup too

* ENH: refactored longest common subsequence, also fixed a bug with the sequence returned

* renamed function
2019-08-19 09:40:36 +02:00
Maxwell Aladago
5d46a4dd7b ENH: Added a functionality to make it possible to reconstruct an optimal subset for the dynamic programming problem (#1139)
* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* function for the knapsack problem which returns one of the optimal subsets

* some pep8 cleanup too
2019-08-19 07:39:39 +02:00
Sanders Lin
f64b602938 Update max_sub_array.py (#1000)
* Update max_sub_array.py

added another method of computing maximum sum subarray

* Update max_sub_array.py

* Update max_sub_array.py
2019-07-17 18:12:24 +02:00