* Enhance readability of N Queens
* Simplify is_safe code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Apply suggestions from code review
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
* Updated test cases of power_sum.py
* updated
* updated.
* remove extra comment and used ** instead of pow
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update backtracking/power_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: Tianyi Zheng <tianyizheng02@gmail.com>
* Replacing the generator with numpy vector operations from lu_decomposition.
* Revert "Replacing the generator with numpy vector operations from lu_decomposition."
This reverts commit ad217c6616.
* Replacing the example in doctest with a less resource-intensive example.
* Fix: Issue 9588
* Fix: Issue 9588
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix: Issue 9588
* Fix: Issue #9588
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix: Issue #9588
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix: Issue #9588
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: issue #9793
* fix: issue #9793
* fix: issue #9588
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: issue #9844
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: issue #9844
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: issue #9844
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix: issue #9844
* [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>
* UPDATED rat_in_maze.py
* Update reddit.py in Webprogramming b/c it was causing error in pre-commit tests while raising PR.
* UPDATED rat_in_maze.py
* fixed return type to only maze,otherwise raise valueError.
* fixed whitespaces error,improved matrix visual.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updated.
* Try
* updated
* updated
* Apply suggestions from code review
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* DRAFT: GitHub Actions: Test on Python 3.12
Repeats #8777
* #8777
Some of our dependencies will not be ready yet.
* Python 3.12: Disable qiskit and tensorflow algorithms
* updating DIRECTORY.md
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* Add powersum problem
* Add doctest
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add more doctests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add more doctests
* Improve paramater name
* Fix line too long
* Remove global variables
* Apply suggestions from code review
* Apply suggestions from code review
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.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>
* add backtracking word search
* updating DIRECTORY.md
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* review notes fixes
* additional fixes
* add tests
* small cleanup
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* small cleanup 2
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update backtracking/word_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update backtracking/word_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update backtracking/word_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update backtracking/word_search.py
Co-authored-by: Christian Clauss <cclauss@me.com>
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: Christian Clauss <cclauss@me.com>
* Create minmax.py
* Update minmax.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>
* Added 5 README files
* corrected arithmetic_analysis README
* Update audio_filters/README.md
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Update backtracking/README.md
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Update bit_manipulation/README.md
Co-authored-by: John Law <johnlaw.po@gmail.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
* Remove redundent function
After reviewing this code, I've noticed that the `is_completed` function is a redundant operation.
Increasing the number of loops required for each step of the sudoku solver.
This should remove n² operations where n is the width of the grid.
* Update sudoku.py
Remove additional newline
* Added static typing to backtracking algorithms
* Ran psf/black to fix some minor issues.
* updating DIRECTORY.md
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: John Law <johnlaw.po@gmail.com>
* added type hints and doctests for minimax algorithm
* Update backtracking/minimax.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* last fix
Co-authored-by: Christian Clauss <cclauss@me.com>
* 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>
* add new file for another solution to the n queens problem
* Add the code for the algorithm, add comments and add at the top a general explanation
* Update backtracking/n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update backtracking/n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update backtracking/n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update backtracking/n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* No newline at the end of the file
* Type hints
* whitespaces fixed
* Fixed whitespaces
* Add type hints
* CodeSpell fixed
* update
* All changes made except changing the board variable to local
* Add doctest
* Update
* Update
* Update
* Update n_queens_math.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* 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>
* Fix line break after binary operator
* fixup! Format Python code with psf/black push
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
* 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>
* 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>