* added a problem with solution on sliding window.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added hint for return type and parameter
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_size_subarray_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_size_subarray_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_size_subarray_sum.py
* Update minimum_size_subarray_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_size_subarray_sum.py
* removed un-necessary docs and added 2 test cases
* Rename sliding_window/minimum_size_subarray_sum.py to dynamic_programming/minimum_size_subarray_sum.py
* Update minimum_size_subarray_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_size_subarray_sum.py
* Update minimum_size_subarray_sum.py
* Update minimum_size_subarray_sum.py
* Update minimum_size_subarray_sum.py
* Update minimum_size_subarray_sum.py
* Update minimum_size_subarray_sum.py
* Update dynamic_programming/minimum_size_subarray_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update dynamic_programming/minimum_size_subarray_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update dynamic_programming/minimum_size_subarray_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update dynamic_programming/minimum_size_subarray_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update dynamic_programming/minimum_size_subarray_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update dynamic_programming/minimum_size_subarray_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update dynamic_programming/minimum_size_subarray_sum.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update minimum_size_subarray_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_size_subarray_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_size_subarray_sum.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_size_subarray_sum.py
* Update minimum_size_subarray_sum.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>
* Remove python_version < "3.11" for tensorflow
* Reenable neural_network/input_data.py_tf
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Try to fix ruff
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Try to fix ruff
* Try to fix ruff
* Try to fix ruff
* Try to fix pre-commit
* Try to fix
* Fix
* Fix
* Reenable dynamic_programming/k_means_clustering_tensorflow.py_tf
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Try to fix ruff
---------
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>
* added kadane's algorithm directory with one problem's solution.
* added type hints
* Rename kaadne_algorithm/max_product_subarray.py to dynamic_programming/max_product_subarray.py
* Update dynamic_programming/max_product_subarray.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update dynamic_programming/max_product_subarray.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update max_product_subarray.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update max_product_subarray.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update max_product_subarray.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update max_product_subarray.py
* Update max_product_subarray.py
* Update dynamic_programming/max_product_subarray.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 dynamic_programming/max_product_subarray.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update max_product_subarray.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>
* pre-commit: Upgrade psf/black for stable style 2023
Updating https://github.com/psf/black ... updating 22.12.0 -> 23.1.0 for their `2023 stable style`.
* https://github.com/psf/black/blob/main/CHANGES.md#2310
> This is the first [psf/black] release of 2023, and following our stability policy, it comes with a number of improvements to our stable style…
Also, add https://github.com/tox-dev/pyproject-fmt and https://github.com/abravalheri/validate-pyproject to pre-commit.
I only modified `.pre-commit-config.yaml` and all other files were modified by pre-commit.ci and psf/black.
* [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>
* refactor: Condense `password` related files in one
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update other/password.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* dynamic_programming
* test: Make test input `str`
* requirements.txt: Remove cython>=0.29.28 # For statsmodels on Python 3.11
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* add dp up - down minimum cost for tickets
* add typints
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add new tests and checks.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add more tests
* add types for the dp function
* Update dynamic_programming/minimum_tickets_cost.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* fix review notes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* small fix
* Update dynamic_programming/minimum_tickets_cost.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update dynamic_programming/minimum_tickets_cost.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
* fix tests
* Update dynamic_programming/minimum_tickets_cost.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update dynamic_programming/minimum_tickets_cost.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>
* Refactor bottom-up function to be class method
* Add type hints
* Update convolve function namespace
* Remove depreciated np.float
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* Renamed function for consistency
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com>
* 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>
* 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>
* 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>
* 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>
* Adopt Python >= 3.8 assignment expressions using auto-walrus
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
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>
* Create minimums_squares_to_represent_a_number.py
added a dynamic programming approach of finding the minimum number of square to represent a number.
eg :
25 = 5*5
37 = 6*6 + 1*1
21 = 4*4 + 2*2 + 1*1
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update and rename minimums_squares_to_represent_a_number.py to minimum_squares_to_represent_a_number.py
updated the code
* Update minimum_squares_to_represent_a_number.py
I have added the appropriate checks for 0 and 12.34.
It would be great if you could suggest a name for the dp array
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_squares_to_represent_a_number.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_squares_to_represent_a_number.py
updated
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update minimum_squares_to_represent_a_number.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>
* Update knapsack.py
* Update dynamic_programming/knapsack.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update knapsack.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>
* ci: Add ``flake8-pep3101`` plugin to ``pre-commit``
* refactor: Remove all modulo string formatting
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* refactor: Remove ``flake8-pep3101`` plugin from ``pre-commit``
* revert: Revert to modulo formatting
* refactor: Use f-string instead of `join`
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add all_construct dynamic programming implementation
* all_construct: remove the main function
* all_construct: Add type hints
* all_construct: changed map to list comprehension,fix mutable default arguments
* all_construct: fixed type hints
* all_construct: cleaner code for initializing word_bank argument
* all_construct: added an import for annotations
* all_construct: added None in the argument with word_bank
* all_construct: fixed a type hint
* all_construct: Fixed some more type hints
* Removed doctest call
* Removed 0 and 1 append to `fib_array`
* Moved fibonacci sequence logic into `calculate`
* Refactored `get` to generate missing numbers
* Renamed `fib_array` to `sequence`
* Renamed `number` to `index`
* Refactored `get` to only return sequence to `index`
* Moved main block into function
* Added documentation to `get`
* Added missing type hints
* Fixed doctest error in `get` docstring
* Moved calculate logic into get
* Reformatted with black
* Fixed wrong generation range
* 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>
* 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>