Skip to content

Leetcode_problems: merge feat/upgrade into main#2

Open
aliammari1 wants to merge 9 commits into
mainfrom
feat/upgrade
Open

Leetcode_problems: merge feat/upgrade into main#2
aliammari1 wants to merge 9 commits into
mainfrom
feat/upgrade

Conversation

@aliammari1

@aliammari1 aliammari1 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

This PR brings the feat/upgrade work into main for Leetcode_problems — 9 commits, 23 files changed, 1837 insertions(+), 89 deletions(-).

What's in here

  • chore: keep internal growth/marketing notes out of the repo
  • docs: star-growth hook, SEO page titles, lessons index, growth kit
  • docs: trending polish — pattern index, live demo URL, banner prompt, FUNDING
  • chore: community health, dependency bots, pre-commit, banner brief
  • feat: gated docs deploy + AI explanation/review workflows
  • ci: real compile/lint gates replacing the vacuous g++ CI
  • feat: add C++/SQL/docs tooling configs
  • feat: add progress generator and reconcile stats from a single source
  • chore: relicense to MIT and reconcile README stats

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.py reconciles unique slugs vs total submissions and updates README + docs/progress.json.
    • mkdocs-material site with per-problem pages, verdict history, and language tabs; gated deploy to Cloudflare Pages.
    • Automated explanation generator writes EXPLANATION.md for accepted solutions and can auto-tag patterns; opens a PR with changes.
    • Exact-match SEO titles via scripts/problem_numbers.json.
    • README overhauled with dynamic badges, a Lessons index, and corrected SQL labeling.
    • Re-licensed to MIT with a LeetCode IP note; added FUNDING and SECURITY policy.
  • CI/Tooling

    • Real C++ syntax gate: injects #include <bits/stdc++.h> + using namespace std; then runs g++ -std=c++20 -fsyntax-only.
    • clang-format + cpp-linter for C++; sqlfluff lint for .oraclesql (oracle) and .mysql (mysql).
    • Progress check (generate_progress.py --check) and mkdocs build --strict enforced in CI.
    • Pre-commit mirrors the gates; added .clang-format, .sqlfluff, .gitattributes, .gitignore.
    • Dependabot enabled for github-actions and pip docs deps; solution issue template added.

Written for commit e2b65bf. Summary will update on new commits.

Review in cubic

aliammari1 and others added 9 commits June 12, 2026 02:11
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>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @aliammari1, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@aliammari1, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 642df3d5-a0fd-4d65-8d9e-2a7712224fb3

📥 Commits

Reviewing files that changed from the base of the PR and between b432621 and e2b65bf.

📒 Files selected for processing (23)
  • .clang-format
  • .coderabbit.yaml
  • .gitattributes
  • .github/FUNDING.yml
  • .github/ISSUE_TEMPLATE/solution_issue.md
  • .github/dependabot.yml
  • .github/workflows/ai-explain.yml
  • .github/workflows/ci.yml
  • .github/workflows/claude-review.yml
  • .github/workflows/docs.yml
  • .gitignore
  • .pre-commit-config.yaml
  • .sqlfluff
  • LICENSE
  • README.md
  • SECURITY.md
  • docs/progress.json
  • mkdocs.yml
  • requirements-docs.txt
  • scripts/ai_explain.py
  • scripts/compile_check.py
  • scripts/generate_progress.py
  • scripts/problem_numbers.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/upgrade

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread .github/workflows/ci.yml
# 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[@]}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread .github/workflows/ci.yml
# 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[@]}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Comment thread scripts/ai_explain.py
model=args.model,
max_tokens=2000,
system=SYSTEM_PROMPT,
thinking={"type": "adaptive"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Comment thread mkdocs.yml
icon:
repo: fontawesome/brands/github

markdown_extensions:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant