Ankur Kataria 9391f546d6 perf(project_euler): replace problem_092/sol1 with digit DP (~1500x speedup) (#15141)
* perf(project_euler): replace problem_092 sol1 with digit DP

The previous solution iterated all 10,000,000 values in a Python-level
for-loop (~6 s on GitHub Actions CI).

The new approach uses digit DP over the decimal digits of (number-1):
counts in O(k * 568 * 10) ~ 40k ops how many integers in [0, number-1]
have each digit-square sum, then multiplies by a precomputed lookup of
whether each sum eventually reaches 89.
Running time on the default input drops from ~6 s to ~0.004 s (~1500x).

Closes #8594

* perf(project_euler): replace problem_092/sol1 with digit DP

* chore: remove workflow artifact (.oss-upstream)
2026-08-31 23:37:40 +02:00
2025-07-06 01:35:29 +03:00
2026-08-30 10:07:24 +02:00
2026-08-30 12:49:06 +02:00
2026-08-30 12:49:06 +02:00
2025-08-30 13:11:57 +03:00
2026-08-30 12:49:06 +02:00

The Algorithms - Python

Gitpod Ready-to-Code Contributions Welcome Discord chat Gitter chat
GitHub Workflow Status pre-commit code style: black

All algorithms implemented in Python - for education 📚

Implementations are for learning purposes only. They may be less efficient than the implementations in the Python standard library. Use them at your discretion.

🚀 Getting Started

📋 Read through our Contribution Guidelines before you contribute.

🌐 Community Channels

We are on Discord and Gitter! Community channels are a great way for you to ask questions and get help. Please join us!

📜 List of Algorithms

See our directory for easier navigation and a better overview of the project.

Languages
Python 99.8%
Shell 0.2%