Leetcode_problems: merge feat/upgrade into main#2
Conversation
Replace the Source-Available "Commercial Use License" with MIT (SPDX-License-Identifier: MIT) plus a footer clarifying that LeetCode problem statements, test data, and trademarks remain LeetCode IP and are not covered. Rework the README: dynamic shields badges sourced from docs/progress.json, a generated PROGRESS block (single source of truth, replacing the self-contradicting 173-vs-544 stats), corrected Oracle/MySQL labelling, accurate SQL example with the // link comment, and new Tooling/Docs/AI sections. Banner referenced as a TODO. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
scripts/generate_progress.py walks solutions/<slug>/<Verdict>/<timestamp>/Solution.<ext> (pathlib, so no shell quoting needed for the spaces+commas in dir names), parses the first-line `// leetcode.com/problems/<slug>` comment, and computes unique slugs (173) vs total submission files (542) plus per-language and per-verdict breakdowns. It regenerates the README PROGRESS block and docs/progress.json (which feeds the dynamic shields badges), and with --docs builds the mkdocs pages. --check fails CI when artifacts drift. Verified: slugs=173, files=542 (496 C++ / 18 Java / 26 Oracle SQL / 2 MySQL), accepted=160 (92.5%). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
.clang-format (Google-based, 4-space) for the bare C++ snippets; .sqlfluff (dialect=oracle default, lenient lint that ignores the // comment line); mkdocs.yml (material, dark pattern theme, content tabs, language tabs); pinned requirements-docs.txt (mkdocs-material in maintenance mode -> pin a known-good version); .gitattributes to keep LF on scripts/configs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The saved snippets have no #include, so the old `g++ ... || echo` CI compiled nothing and always passed. Replace with real jobs that fail on error: - cpp-syntax: preamble-injection gate (inject bits/stdc++.h + using namespace std into a temp file, then g++ -std=c++20 -fsyntax-only -Wall). - clang-format + cpp-linter (format-only; no compile DB for bare snippets). - sqlfluff: --dialect oracle for .oraclesql, --dialect mysql for .mysql. - progress: generate_progress.py --check (stats must match solutions/). - docs: mkdocs build --strict. All file globbing is NUL-delimited and quoted (verdict/timestamp dirs contain spaces and commas). Verified locally: sqlfluff passes on all 26 Oracle + 2 MySQL files; generator --check and mkdocs --strict both pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- docs.yml: build mkdocs and deploy to Cloudflare Pages via wrangler-action, gated on CLOUDFLARE_API_TOKEN/ACCOUNT_ID (build-only when secrets absent; no CF account needed during development). - ai-explain.yml + scripts/ai_explain.py: for each Accepted solution, Claude (claude-sonnet-4-6, configurable) writes EXPLANATION.md covering approach, complexity, and a diff vs the sibling Wrong-Answer/Runtime-Error attempts -- the unique hook. No-op when ANTHROPIC_API_KEY is unset. Output folds into the mkdocs problem pages and can auto-tag difficulty/pattern. - claude-review.yml: claude-code-action PR review, gated on the API key. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Dependabot (github-actions) + Renovate (one config each; pick one when enabling), pre-commit mirroring the CI gates, CodeRabbit config (skips historical snippets), SECURITY.md (tooling-scoped), a solution issue template, and BANNER.md describing the pattern-grid dark direction (assets/ banner is a TODO, referenced in README). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…FUNDING - README: add 14-pattern index (all slugs verified to exist), SQL-50/Oracle track section, live Cloudflare Pages demo URL + deploy steps, sharper docs showcase copy. - BANNER.md: finalize into one verbatim image-gen prompt (dark pattern grid, 14 pattern tiles, C++/Java/Oracle marks, "173 problems · 542 submissions", 1280x640 + hero); README references assets/banner.png. - Add .github/FUNDING.yml (github: aliammari1). - Remove duplicate renovate.json; fold pip ecosystem into Dependabot so a single dependency bot covers github-actions + docs deps (no duplicate update PRs). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- README H1 is now the killer hook ("every problem I solved — including my
real Wrong-Answer / TLE submissions and the lesson from each"); add a
searchable "Browse all 173 problems" top button, a star CTA, and the
leetcode-solutions MCP (Wave 2) teaser. Keep accurate 173/542 stats.
- SEO: per-slug docs page titles are now exact "<#>. <Problem> — Solution"
via a new scripts/problem_numbers.json slug->number map (graceful fallback
when a number is unknown).
- New docs/lessons.md "Lessons / common mistakes" index (89 problems with
real failed attempts, 265 preserved) + nav entry; docs home surfaces it and
the searchable browse button.
- Cross-link footer (Related: HackerRank archive + profile hub + LeetCode) on
every problem page, the docs home, and the README.
- Add GROWTH.md: About, 8 topics (leetcode, leetcode-solutions, algorithms,
sql, oracle-sql, interview-prep, coding-interview, data-structures), the
r/leetcode "public WITH all my failed submissions" post, awesome-list
submission lines, and the MCP angle.
Verified: mkdocs build --strict (clean, 173 pages) and
generate_progress.py --check both pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Sorry @aliammari1, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Warning Review limit reached
More reviews will be available in 59 minutes and 27 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (23)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2b65bfeff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Paths contain spaces and commas — NUL-delimit and quote. | ||
| mapfile -d '' files < <(find solutions -type f -name 'Solution.cpp' -print0) | ||
| if [ ${#files[@]} -eq 0 ]; then echo "no C++ files"; exit 0; fi | ||
| clang-format --dry-run --Werror "${files[@]}" |
There was a problem hiding this comment.
Restrict clang-format or reformat existing snippets
When this new CI job runs on the current repository, the exact command in this step fails immediately because many existing solutions/**/Solution.cpp files are not formatted with the new .clang-format rules; I ran the same find ... | clang-format --dry-run --Werror block and it reported thousands of violations, including accepted files such as solutions/diagonal-traverse/Accepted/8-26-2023, 10_44_24 AM/Solution.cpp and solutions/robot-return-to-origin/Accepted/10-18-2023, 2_01_02 AM/Solution.cpp. Since the commit adds this workflow without reformatting or scoping it to changed/formatted files, every push/PR is blocked by pre-existing archive formatting rather than new changes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
3 issues found across 23 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/ci.yml">
<violation number="1" location=".github/workflows/ci.yml:55">
P1: This `clang-format --dry-run --Werror` check runs against **all** existing `Solution.cpp` files, but the `.clang-format` config is newly introduced and existing files were never reformatted to match it. CI will fail on every push/PR due to pre-existing formatting violations in the archive. Either scope this to only changed files (e.g., using `git diff --name-only` filtered to `.cpp`), or reformat the existing files as part of this PR.</violation>
</file>
<file name="scripts/ai_explain.py">
<violation number="1" location="scripts/ai_explain.py:165">
P2: `--model` is configurable, but the request hardcodes adaptive thinking for every model. This breaks custom models that do not support adaptive thinking.</violation>
</file>
<file name="mkdocs.yml">
<violation number="1" location="mkdocs.yml:39">
P3: Add `pymdownx.emoji` here so Material icon shortcodes in generated docs render correctly.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| # Paths contain spaces and commas — NUL-delimit and quote. | ||
| mapfile -d '' files < <(find solutions -type f -name 'Solution.cpp' -print0) | ||
| if [ ${#files[@]} -eq 0 ]; then echo "no C++ files"; exit 0; fi | ||
| clang-format --dry-run --Werror "${files[@]}" |
There was a problem hiding this comment.
P1: This clang-format --dry-run --Werror check runs against all existing Solution.cpp files, but the .clang-format config is newly introduced and existing files were never reformatted to match it. CI will fail on every push/PR due to pre-existing formatting violations in the archive. Either scope this to only changed files (e.g., using git diff --name-only filtered to .cpp), or reformat the existing files as part of this PR.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/ci.yml, line 55:
<comment>This `clang-format --dry-run --Werror` check runs against **all** existing `Solution.cpp` files, but the `.clang-format` config is newly introduced and existing files were never reformatted to match it. CI will fail on every push/PR due to pre-existing formatting violations in the archive. Either scope this to only changed files (e.g., using `git diff --name-only` filtered to `.cpp`), or reformat the existing files as part of this PR.</comment>
<file context>
@@ -0,0 +1,109 @@
+ # Paths contain spaces and commas — NUL-delimit and quote.
+ mapfile -d '' files < <(find solutions -type f -name 'Solution.cpp' -print0)
+ if [ ${#files[@]} -eq 0 ]; then echo "no C++ files"; exit 0; fi
+ clang-format --dry-run --Werror "${files[@]}"
+
+ cpp-linter:
</file context>
| model=args.model, | ||
| max_tokens=2000, | ||
| system=SYSTEM_PROMPT, | ||
| thinking={"type": "adaptive"}, |
There was a problem hiding this comment.
P2: --model is configurable, but the request hardcodes adaptive thinking for every model. This breaks custom models that do not support adaptive thinking.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/ai_explain.py, line 165:
<comment>`--model` is configurable, but the request hardcodes adaptive thinking for every model. This breaks custom models that do not support adaptive thinking.</comment>
<file context>
@@ -0,0 +1,191 @@
+ model=args.model,
+ max_tokens=2000,
+ system=SYSTEM_PROMPT,
+ thinking={"type": "adaptive"},
+ messages=[{"role": "user", "content": prompt}],
+ ) as stream:
</file context>
| icon: | ||
| repo: fontawesome/brands/github | ||
|
|
||
| markdown_extensions: |
There was a problem hiding this comment.
P3: Add pymdownx.emoji here so Material icon shortcodes in generated docs render correctly.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At mkdocs.yml, line 39:
<comment>Add `pymdownx.emoji` here so Material icon shortcodes in generated docs render correctly.</comment>
<file context>
@@ -0,0 +1,70 @@
+ icon:
+ repo: fontawesome/brands/github
+
+markdown_extensions:
+ - admonition
+ - attr_list
</file context>
This PR brings the
feat/upgradework intomainfor Leetcode_problems — 9 commits, 23 files changed, 1837 insertions(+), 89 deletions(-).What's in here
Files
23 files changed, 1837 insertions(+), 89 deletions(-)
🤖 Generated with Claude Code
Summary by cubic
Modernizes the archive with MIT licensing, a single source of truth for progress stats, a generated docs site, and strict CI that actually compiles/lints snippets. Stats are accurate, docs are searchable, and deploys are gated and reproducible.
New Features
scripts/generate_progress.pyreconciles unique slugs vs total submissions and updates README +docs/progress.json.mkdocs-materialsite with per-problem pages, verdict history, and language tabs; gated deploy to Cloudflare Pages.EXPLANATION.mdfor accepted solutions and can auto-tag patterns; opens a PR with changes.scripts/problem_numbers.json.CI/Tooling
#include <bits/stdc++.h>+using namespace std;then runsg++ -std=c++20 -fsyntax-only.clang-format+cpp-linterfor C++;sqlflufflint for.oraclesql(oracle) and.mysql(mysql).generate_progress.py --check) andmkdocs build --strictenforced in CI..clang-format,.sqlfluff,.gitattributes,.gitignore.github-actionsandpipdocs deps; solution issue template added.Written for commit e2b65bf. Summary will update on new commits.