Commit Graph

3600 Commits

Author SHA1 Message Date
Christian Clauss
9372040da9 Test on Python 3.14 (#12710) 2025-10-07 18:23:37 +02:00
pre-commit-ci[bot]
7530a417e8 [pre-commit.ci] pre-commit autoupdate (#13286)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.13.2 → v0.13.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.13.2...v0.13.3)
- [github.com/tox-dev/pyproject-fmt: v2.6.0 → v2.7.0](https://github.com/tox-dev/pyproject-fmt/compare/v2.6.0...v2.7.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-06 20:49:00 +02:00
pre-commit-ci[bot]
a71618f891 [pre-commit.ci] pre-commit autoupdate (#13006)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.13.1 → v0.13.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.13.1...v0.13.2)

* ci: autoupdate_schedule: monthly

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2025-09-29 20:30:14 +02:00
Dylanskyep
c0ad5bbde4 Add doctests for cross function. Contributes to #9943 (#12991)
* Add doctests for cross function. Contributes to #9943

* Update sudoku_solver.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-09-24 22:18:44 +03:00
kathrynpete
8d1fb262da Added edit_distance test cases (#12984)
* Added edit_distance test cases

* Update edit_distance.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-09-23 09:51:49 +03:00
pre-commit-ci[bot]
e696e4dc90 [pre-commit.ci] pre-commit autoupdate (#12988)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.13.0 → v0.13.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.13.0...v0.13.1)
- [github.com/pre-commit/mirrors-mypy: v1.18.1 → v1.18.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.18.1...v1.18.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-23 02:18:01 +02:00
lighting9999
4ec71a303b fix covid_stats_via_xpath.py (#12975)
* fix covid_stats_via_xpath.py

Improve error handling.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix covid_stats_via_xpath.py typo

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix ruff

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* upgrade covid_stats_via_xpath.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update and fix covid_stats_via_xpath.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-18 15:55:59 +02:00
pre-commit-ci[bot]
0ee534edde [pre-commit.ci] pre-commit autoupdate (#12969)
updates:
- [github.com/pre-commit/mirrors-mypy: v1.17.1 → v1.18.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.17.1...v1.18.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-15 20:17:29 +02:00
Christian Clauss
63180d7e24 pre-commit autoupdate 2025-09-11 (#12963)
* pre-commit autoupdate 2025-09-11

* [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>
2025-09-13 01:56:14 +03:00
pre-commit-ci[bot]
18c853d301 [pre-commit.ci] pre-commit autoupdate (#12961)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.11 → v0.12.12](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.11...v0.12.12)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-08 20:46:04 +02:00
Juan Dupierris
8f1a6b0ca0 Adding the function is_proth_number (#12399)
* Adding the function isProthNumber(n : int) which returns true if n is a Proth number

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixing the issues of the isprothnumber function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* New fixes on isprothnumber()

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixes on isprothnumber()

* Fixes on isprothnumber

* Fixes on isprothnumber()

* Fixes on isprothnumber

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

* Update proth_number.py

---------

Co-authored-by: Juanitoupipou <juan.dupierris@imt-atlantique.net>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-09-08 02:41:07 +03:00
dependabot[bot]
4ce1185f9e Bump actions/setup-python from 5 to 6 (#12952)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-05 08:23:36 +02:00
hema_ameh
544f48ff34 Fix is_palindrome_recursive logic in strings/palindrome.py (#12946)
* Fix: is_palindrome_recursive logic for 2-char strings

* Update palindrome.py

* Update palindrome.py

* Update palindrome.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-09-04 03:49:59 +03:00
pre-commit-ci[bot]
0876a87186 [pre-commit.ci] pre-commit autoupdate (#12944)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.10 → v0.12.11](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.10...v0.12.11)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-01 20:33:56 +02:00
ANANT JAIN
9d52683ecb Create stalin_sort.py (#11989)
* Create stalin_sort.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update stalin_sort.py

* updating DIRECTORY.md

* Update stalin_sort.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
2025-08-31 01:17:55 +03:00
lorenzo30salgado
e3a263c1ed Adding a 3D plot to the k-means clustering algorithm (#12372)
* Adding a 3D plot to the k-means clustering algorithm

* Update k_means_clust.py

* Update k_means_clust.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-30 23:58:54 +03:00
ANIRUDDHA ADAK
501576f90e Update README.md (#12345)
* Update README.md

Add emojis for enhanced visual appeal and readability in README .

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update README.md

* Update README.md

* Update README.md

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-30 13:11:57 +03:00
Ronald Ngounou
b0920454cc Add unit tests to binary_tree_path_sum.py (#11833)
* test: Add unit tests

* test: Add successful tests in binaree_tree_path_sum

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update binary_tree_path_sum.py

* Update binary_tree_path_sum.py

* Update binary_tree_path_sum.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-30 11:49:44 +03:00
Abhijit Kumar Singh
1e0d3173fa Specify space complexity for merge sort (#11749)
* Added space complexity

Space complexity of merge sort is a key factor, when compared to quick sort

* Update merge_sort.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-30 03:37:13 +03:00
Sohail khan
c5de3954cc Add new test for bucket sort algorithm in sorts/bucket_sort.py (#11605)
* Add new test for bucket sort algorithm in sorts/bucket_sort.py

* Update fractional_knapsack.py

* Update matrix_class.py

* Update bucket_sort.py

* Update bucket_sort.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-30 03:28:38 +03:00
Venkata Ramana Menda
488f143b8c Performance: 25% faster Project Euler 73 #10503 (#11553)
* Seperate slow_solution and solution

* Add performance benchmark

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix issues

* Update sol1.py

* Update sol1.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-30 03:16:21 +03:00
Aasheesh
5c50572476 Fixing stock_span_problem.py (#10540)
* Adding doctests in simpson_rule.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update stock_span_problem.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update subset_generation.py

* Update subset_generation.py

* Update data_structures/stacks/stock_span_problem.py

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

* Update stock_span_problem.py

* Update data_structures/stacks/stock_span_problem.py

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

* Update stock_span_problem.py

* Update stock_span_problem.py

* updating DIRECTORY.md

* Update stock_span_problem.py

* Update stock_span_problem.py

* Update stock_span_problem.py

* Update stock_span_problem.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>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
2025-08-30 02:17:31 +03:00
__Aditya
4394fd93d3 Weierstrass Method (#12877)
* Add weierstrass_method for approximating complex roots

- Implements Durand-Kerner (Weierstrass) method for polynomial root finding
- Accepts user-defined polynomial function and degree
- Uses random perturbation of complex roots of unity for initial guesses
- Handles validation, overflow clipping, and includes doctest

* Update weierstrass_method.py
* add more tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update weierstrass_method.py

* Update weierstrass_method.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-29 17:33:43 +01:00
Praful Katare
54aa73fdf0 Fixes bugs in graphs/dijkstra_algorithm.py (#10092)
* Fixes bug in PriorityQueue Algorithm; Fixes syntax in code for array.

* Update dijkstra_algorithm.py

* Update dijkstra_algorithm.py

* Update dijkstra_algorithm.py

* Update dijkstra_algorithm.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-28 01:45:05 +03:00
Prathamesh Gadekar
84f101ca6e Add/generate parentheses iterative approach (#10024)
* Generate parantheses iterative

* Generate parantheses iterative

* Generating parantheses code using iterative approach

* Update generate_parentheses_iterative.py

* updating DIRECTORY.md

* Update generate_parentheses_iterative.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update generate_parentheses_iterative.py

* Update generate_parentheses_iterative.py

* Update generate_parentheses_iterative.py

---------

Co-authored-by: nightmare10123 <pgadekar10123@gmail.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-28 01:22:12 +03:00
architmaheshwari99
e6b5d26d5c Combination sum fix and test cases (#10193)
* fixed_incorrect_test_combination_sum

* reverting fn arg

* ruff

* Update combination_sum.py

* Update combination_sum.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-28 00:07:46 +03:00
Mary-0165
0c39e43af7 Algorithm to find unique prime factors (#9935)
* algorithm to find unique prime factors

* Update prime_factors.py

* Update prime_factors.py

* Update prime_factors.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-27 23:55:27 +03:00
Shreyash Kashyap
2fa65c7d92 Improve blockchain/README.md (#9630)
* Update README.md

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update blockchain/README.md

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>

* Update README.md

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2025-08-27 23:41:04 +03:00
Om Ashishkumar Soni
b486ac60e6 added coordinate_compression (#9317)
* added coordinate_compression algorithm

* added coordinate_compression & doctest

* adding return type hints and utilized enumerate

* adding exmaple usage in main function

* added type hints, for list and dict

* updating DIRECTORY.md

* Update other/coordinate_compression.py

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

* Update other/coordinate_compression.py

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

* Update other/coordinate_compression.py

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

* Update other/coordinate_compression.py

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

* Update other/coordinate_compression.py

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

* Update other/coordinate_compression.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 other/coordinate_compression.py

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

* Update other/coordinate_compression.py

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

* Update coordinate_compression.py

* Create coordinate_compression.py

* updating DIRECTORY.md

* Delete other/coordinate_compression.py

* updating DIRECTORY.md

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

* Update coordinate_compression.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-27 22:02:14 +03:00
Wei Jiang
4961b3aa89 Enhancement of the knapsack algorithm with memorization and generalisation (#9295)
* enhance knapsack problem

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* wei/refactor code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_knapsack.py

* Update knapsack.py

* Update test_knapsack.py

* Update knapsack.py

* Update knapsack.py

* Update knapsack.py

* Update knapsack.py

* Update knapsack.py

* Update test_knapsack.py

---------

Co-authored-by: weijiang <weijiang@weijiangs-MacBook-Pro.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-27 01:10:22 +03:00
Sharan Sukesh
44cf167175 Create cyclic_sort.py (#9256)
* Create cyclic_sort.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update cyclic_sort.py

* updating DIRECTORY.md

* Update cyclic_sort.py

* Update cyclic_sort.py

* Update cyclic_sort.py

* Update cyclic_sort.py

* Update cyclic_sort.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
2025-08-26 21:42:14 +03:00
Mindaugas
55db5a1b8d Add new solution for the euler project problem 9 (#12771)
* Add new solution for the euler project problem 9 - precompute the squares.

* Update sol4.py

* updating DIRECTORY.md

* Update sol4.py

* Update sol4.py

* Update sol4.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: MaximSmolskiy <MaximSmolskiy@users.noreply.github.com>
2025-08-26 21:17:18 +03:00
pre-commit-ci[bot]
dc1b2003b4 [pre-commit.ci] pre-commit autoupdate (#12930)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.9 → v0.12.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.9...v0.12.10)
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.17.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.17.1)

* Update word_break.py

* Update word_break.py

* Update word_break.py

* Update word_break.py

* Update word_break.py

* Update covid_stats_via_xpath.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pyproject.toml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update pyproject.toml

* Update pyproject.toml

* Update covid_stats_via_xpath.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: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-26 15:32:39 +03:00
alejandroaldas
8c1c6c1763 Codex/find and fix a bug (#12782)
* Fix enumeration order in FFT string representation

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update radix2_fft.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: alejandroaldas <alejandroaldas@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-25 01:16:05 +03:00
John Liu
b0be304433 Use deque as queue in breadth_first_search_shortest_path_2.py (#12861)
* Fixes #12857 Use collections.deque as queue in graphs BFS shortest path 2

* Use collections.deque as queue in the correct syntax: queue = deque([start])

* Fix CI error due to HTTP 404 on https://finance.yahoo.com/quote/GOOG/\?p\=GOOG

* Undo change in workflows/build.yml as it's fixed in PR 12864

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-25 00:59:44 +03:00
S. M. Mohiuddin Khan Shiam
561cc383ec Fix RuntimeError in bipartite-check DFS/BFS and clean up doctests (#12814)
* Fix `RuntimeError` in bipartite-check DFS/BFS and clean up doctests

* Iteration over `graph` mutated by `defaultdict` neighbours caused
  `RuntimeError: dictionary changed size during iteration`.
  – Iterate over `list(graph)` in both DFS and BFS helpers.
* Corrected `if __name__ == "__main__":` typo.
* Updated two doctests that now succeed after the fix.

All doctests now pass (`30/30`), eliminating a critical runtime failure and improving reliability of the graph algorithms.

Co-Authored-By: S. M. Mohiuddin Khan Shiam <147746955+mohiuddin-khan-shiam@users.noreply.github.com>

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

* Update check_bipatrite.py

---------

Co-authored-by: Odio Marcelino <odiomarcelino@gmail.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-25 00:47:46 +03:00
Mindaugas
d927d67c4a Update Linked List from sequence script to use doctests (#12766)
* Update comments for linked list script.

* Add doctests for the linked list script.

* Update from_sequence.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-24 17:48:59 +03:00
Sowndappan S
37b34c2bac perf(strings): optimize anagram signature using frequency counts (#12927)
* fix(strings): use frequency-based signature for anagrams

Replaced the sorting-based signature implementation with a frequency-based
approach using `collections.Counter`. This ensures that the signature
represents both characters and their counts, preventing collisions and
better grouping of true anagrams.

Examples:
- "test" → "e1s1t2"
- "finaltest" → "a1e1f1i1l1n1s1t2"
- "this is a test" → " 3a1e1h1i2s3t3"

Also updated the anagram lookup to use the new frequency-based signatures, making results more accurate and avoiding false positives.

* Refactor anagram function return type to list[str]

* Update anagrams.py

* Update anagrams.py

* Update anagrams.py

* Update anagrams.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-24 15:33:18 +03:00
Ahmad Alharbi
d16cac6e4f feat: Add recursive implication function for lists (#12855)
* feat: Add recursive implication function for lists

* Update imply_gate.py

* Update imply_gate.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-24 15:08:52 +03:00
conti
060fd8ee2c Fix reverse_bits.py: correct 32-bit reversal and improve docstrings (#12924)
* Fix reverse_bits.py (#12868)

* Update reverse_bits.py

* Update reverse_bits.py

* Update reverse_bits.py

* Update reverse_bits.py

* Update reverse_bits.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-24 14:49:43 +03:00
Diya
9ddb0272bf Adding doctest for md_prefix function in build_directory_md.py (#12874)
* Adding doctests for md_prefix function in build_directory_md.py

* Update build_directory_md.py

* Update build_directory_md.py

* Update build_directory_md.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-24 14:22:00 +03:00
Chandra Sekhar Pola
c2b90034a0 Fix code style in README.md (#12843)
* Fix #12840 code style

* Update README.md

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-24 14:01:21 +03:00
Milad Khoshdel
a8c5616857 Simplify Capitalize Function (#12879)
* Simplify the capitalize function using ASCII arithmetic to make the algorithm five times faster.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update capitalize.py

* Update capitalize.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
2025-08-24 13:07:39 +03:00
dependabot[bot]
e224532107 Bump actions/upload-pages-artifact from 3 to 4 (#12922)
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](https://github.com/actions/upload-pages-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-23 05:48:47 +02:00
pre-commit-ci[bot]
beb3cfdf28 [pre-commit.ci] pre-commit autoupdate (#12900)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.8 → v0.12.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.8...v0.12.9)
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.17.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.17.1)

* Apply suggestion from @cclauss

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2025-08-19 14:28:03 +02:00
dependabot[bot]
f662b63d1a Bump actions/checkout from 4 to 5 (#12891)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-12 09:30:10 +02:00
pre-commit-ci[bot]
d05f5d22d9 [pre-commit.ci] pre-commit autoupdate (#12880)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0)
- [github.com/astral-sh/ruff-pre-commit: v0.12.5 → v0.12.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.5...v0.12.8)
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.17.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.17.1)

* Apply suggestion from @cclauss

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2025-08-11 21:03:20 +02:00
pre-commit-ci[bot]
7a0fee401d [pre-commit.ci] pre-commit autoupdate (#12864)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.4 → v0.12.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.4...v0.12.5)
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.17.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.17.0)

* Apply suggestion from @cclauss

* --ignore=web_programming/current_stock_price.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>
2025-07-29 17:27:27 -04:00
pre-commit-ci[bot]
6e1a104877 [pre-commit.ci] pre-commit autoupdate (#12846)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.3 → v0.12.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.3...v0.12.4)
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.17.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.17.0)

* Apply suggestion from @cclauss

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2025-07-21 15:29:24 -04:00
pre-commit-ci[bot]
d1a9486f09 [pre-commit.ci] pre-commit autoupdate (#12781)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.11 → v0.12.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.11...v0.12.2)
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.16.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.16.1)

* Update .pre-commit-config.yaml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2025-07-11 23:06:49 +02:00