This repository was archived by the owner on Sep 25, 2026. It is now read-only.
Repository navigation
Leetcode_problems: merge feat/upgrade into main #2
Open
aliammari1
wants to merge
9
commits into
main
Choose a base branch
from
feat/upgrade
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0faf9fe
chore: relicense to MIT and reconcile README stats
aliammari1 149e931
feat: add progress generator and reconcile stats from a single source
aliammari1 3b2074d
feat: add C++/SQL/docs tooling configs
aliammari1 fca4f6a
ci: real compile/lint gates replacing the vacuous g++ CI
aliammari1 9a0a878
feat: gated docs deploy + AI explanation/review workflows
aliammari1 49cc37a
chore: community health, dependency bots, pre-commit, banner brief
aliammari1 15946ab
docs: trending polish — pattern index, live demo URL, banner prompt, …
aliammari1 438ca2c
docs: star-growth hook, SEO page titles, lessons index, growth kit
aliammari1 ca2dfe0
chore: keep internal growth/marketing notes out of the repo
aliammari1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # clang-format config for the C++ solution snippets. | ||
| # These are bare LeetCode editor bodies (no includes), so formatting is the only | ||
| # whole-file check that's meaningful; the syntax gate handles correctness. | ||
| BasedOnStyle: Google | ||
| IndentWidth: 4 | ||
| TabWidth: 4 | ||
| UseTab: Never | ||
| ColumnLimit: 100 | ||
| AllowShortFunctionsOnASingleLine: Empty | ||
| AllowShortIfStatementsOnASingleLine: false | ||
| AllowShortLoopsOnASingleLine: false | ||
| SortIncludes: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # CodeRabbit config — lightweight, archive-appropriate. | ||
| language: en-US | ||
| reviews: | ||
| profile: chill | ||
| request_changes_workflow: false | ||
| high_level_summary: true | ||
| poem: false | ||
| review_status: true | ||
| path_filters: | ||
| - "!solutions/**" # don't nitpick historical submission snippets | ||
| - "scripts/**" | ||
| - ".github/**" | ||
| - "*.md" | ||
| chat: | ||
| auto_reply: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Keep LF for scripts and config so CI bash/Python behave identically on all OSes. | ||
| * text=auto eol=lf | ||
| *.png binary | ||
| *.jpg binary | ||
| *.svg text eol=lf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| github: [aliammari1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| --- | ||
| name: Solution issue | ||
| about: Report an incorrect solution or suggest an improvement | ||
| title: "[slug] short description" | ||
| labels: ["solution"] | ||
| --- | ||
|
|
||
| **Problem slug:** <!-- e.g. two-sum (the directory name under solutions/) --> | ||
|
|
||
| **Language:** <!-- C++ / Java / Oracle SQL / MySQL --> | ||
|
|
||
| **What's wrong / what could be better?** | ||
|
|
||
| <!-- Note: failed-attempt snippets (Wrong Answer/Runtime Error/etc.) are kept on | ||
| purpose as part of the submission history; please don't report those as bugs. --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| version: 2 | ||
| # Archive repo: the only moving dependencies are GitHub Actions and the docs | ||
| # build tooling (requirements-docs.txt). Dependabot is the single dependency | ||
| # bot here — a Renovate config was removed to avoid duplicate update PRs. | ||
| updates: | ||
| - package-ecosystem: github-actions | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| commit-message: | ||
| prefix: "ci" | ||
| labels: ["dependencies"] | ||
| groups: | ||
| github-actions: | ||
| patterns: ["*"] | ||
|
|
||
| - package-ecosystem: pip | ||
| directory: "/" | ||
| schedule: | ||
| interval: weekly | ||
| commit-message: | ||
| prefix: "build" | ||
| labels: ["dependencies"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: AI solution explanations | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| limit: | ||
| description: "Max number of slugs to process (0 = all)" | ||
| default: "20" | ||
| force: | ||
| description: "Overwrite existing EXPLANATION.md" | ||
| type: boolean | ||
| default: false | ||
| schedule: | ||
| # Weekly top-up of any newly-added Accepted solutions lacking an explanation. | ||
| - cron: "0 5 * * 1" | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| explain: | ||
| name: Generate EXPLANATION.md with Claude | ||
| runs-on: ubuntu-latest | ||
| # Gated: the job only runs when ANTHROPIC_API_KEY is configured. | ||
| if: ${{ vars.ENABLE_AI == 'true' || github.event_name == 'workflow_dispatch' }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install Anthropic SDK | ||
| run: pip install "anthropic>=0.40" | ||
|
|
||
| - name: Generate explanations (with WA/RE diff hook) | ||
| env: | ||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| AI_MODEL: ${{ vars.AI_MODEL || 'claude-sonnet-4-6' }} | ||
| run: | | ||
| # Script is a no-op when ANTHROPIC_API_KEY is unset, so this is safe | ||
| # to run on PRs / forks without the secret. | ||
| ARGS="--tag --limit ${{ github.event.inputs.limit || '20' }}" | ||
| if [ "${{ github.event.inputs.force }}" = "true" ]; then ARGS="$ARGS --force"; fi | ||
| python scripts/ai_explain.py $ARGS | ||
|
|
||
| - name: Open PR with new explanations | ||
| if: ${{ env.HAS_KEY == 'true' }} | ||
| env: | ||
| HAS_KEY: ${{ secrets.ANTHROPIC_API_KEY != '' }} | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| commit-message: "docs: add AI-generated solution explanations" | ||
| title: "docs: AI solution explanations" | ||
| body: | | ||
| Auto-generated `EXPLANATION.md` files (approach, complexity, and a | ||
| diff vs the recorded Wrong-Answer / Runtime-Error attempts). | ||
| Review before merging. | ||
| branch: ai/explanations | ||
| add-paths: | | ||
| solutions/**/EXPLANATION.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ci-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| progress: | ||
| name: Progress table is current | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| # Fails if README's PROGRESS block or docs/progress.json drifted from | ||
| # solutions/ — keeps the 173-vs-542 stats honest and reconciled. | ||
| - name: Check generated stats | ||
| run: python scripts/generate_progress.py --check | ||
|
|
||
| cpp-syntax: | ||
| name: C++ preamble-injection syntax gate | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Install g++ | ||
| run: sudo apt-get update && sudo apt-get install -y g++ | ||
| # Injects `#include <bits/stdc++.h>` + `using namespace std;` then runs | ||
| # g++ -fsyntax-only. Real errors fail the build (no `|| echo`). | ||
| - name: Syntax-check all Accepted C++ solutions | ||
| run: python scripts/compile_check.py --cxx g++ --std c++20 | ||
|
|
||
| clang-format: | ||
| name: clang-format | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: clang-format check (quoted globs) | ||
| run: | | ||
| # 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: This Prompt for AI agents |
||
|
|
||
| cpp-linter: | ||
| name: cpp-linter | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: cpp-linter/cpp-linter-action@v2 | ||
| id: linter | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| style: file | ||
| tidy-checks: "-*" # format-only; bare snippets have no compile DB | ||
| files-changed-only: false | ||
| extensions: cpp | ||
| - name: Fail on lint findings | ||
| if: steps.linter.outputs.checks-failed > 0 | ||
| run: exit 1 | ||
|
|
||
| sql: | ||
| name: sqlfluff (Oracle + MySQL) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Install sqlfluff | ||
| run: pip install "sqlfluff==3.3.0" | ||
| - name: Lint Oracle SQL (quoted globs) | ||
| run: | | ||
| mapfile -d '' files < <(find solutions -type f -name '*.oraclesql' -print0) | ||
| if [ ${#files[@]} -eq 0 ]; then echo "no Oracle SQL"; exit 0; fi | ||
| sqlfluff lint --dialect oracle "${files[@]}" | ||
| - name: Lint MySQL (quoted globs) | ||
| run: | | ||
| mapfile -d '' files < <(find solutions -type f -name '*.mysql' -print0) | ||
| if [ ${#files[@]} -eq 0 ]; then echo "no MySQL"; exit 0; fi | ||
| sqlfluff lint --dialect mysql "${files[@]}" | ||
|
|
||
| docs: | ||
| name: mkdocs build (strict) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Install docs deps | ||
| run: pip install -r requirements-docs.txt | ||
| - name: Generate pages | ||
| run: python scripts/generate_progress.py --docs | ||
| - name: Build | ||
| run: mkdocs build --strict | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Claude PR review | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize] | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| jobs: | ||
| review: | ||
| name: "@claude review" | ||
| runs-on: ubuntu-latest | ||
| # Gated on the secret: skips cleanly when ANTHROPIC_API_KEY is absent. | ||
| if: ${{ github.event_name == 'pull_request' || contains(github.event.comment.body, '@claude') }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Claude Code Action | ||
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| # Configurable; defaults to Sonnet for cost on an archive repo. | ||
| model: ${{ vars.AI_MODEL || 'claude-sonnet-4-6' }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Deploy docs (Cloudflare Pages) | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: docs-deploy | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| deploy: | ||
| name: Build & deploy to Cloudflare Pages | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install docs deps | ||
| run: pip install -r requirements-docs.txt | ||
|
|
||
| - name: Generate per-slug pages | ||
| run: python scripts/generate_progress.py --docs | ||
|
|
||
| - name: Build site | ||
| run: mkdocs build --strict | ||
|
|
||
| # Gated: only deploys when the Cloudflare secrets are configured. On forks | ||
| # / PRs without them this whole step is skipped, so the workflow stays | ||
| # green without ever needing a CF account during development. | ||
| - name: Check Cloudflare secrets | ||
| id: cf | ||
| run: | | ||
| if [ -n "${{ secrets.CLOUDFLARE_API_TOKEN }}" ] && [ -n "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" ]; then | ||
| echo "enabled=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "enabled=false" >> "$GITHUB_OUTPUT" | ||
| echo "::notice::Cloudflare secrets not set — skipping deploy (build verified only)." | ||
| fi | ||
|
|
||
| - name: Deploy to Cloudflare Pages | ||
| if: steps.cf.outputs.enabled == 'true' | ||
| uses: cloudflare/wrangler-action@v3 | ||
| with: | ||
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| command: pages deploy site --project-name=leetcode-problems |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # mkdocs build output | ||
| /site/ | ||
|
|
||
| # Generated docs pages (rebuilt by scripts/generate_progress.py --docs in CI; | ||
| # not committed to avoid churn). Only docs/progress.json is committed so the | ||
| # README's dynamic badges resolve without needing a docs build. | ||
| /docs/problems/ | ||
| /docs/index.md | ||
| /docs/tags.md | ||
| /docs/lessons.md | ||
|
|
||
| # Python | ||
| __pycache__/ | ||
| *.pyc | ||
| .venv/ | ||
| venv/ | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Internal growth/marketing notes (not for public) | ||
| GROWTH.md | ||
| BANNER.md | ||
| SUBMITTING_TO_AWESOME.md | ||
| launch-kit.md | ||
| star-strategy.md | ||
| modernization-backlog.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Mirrors the CI gates locally. Install: pip install pre-commit && pre-commit install | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: end-of-file-fixer | ||
| exclude: '^solutions/' | ||
| - id: trailing-whitespace | ||
| exclude: '^solutions/' | ||
| - id: check-yaml | ||
|
|
||
| - repo: https://github.com/pre-commit/mirrors-clang-format | ||
| rev: v19.1.5 | ||
| hooks: | ||
| - id: clang-format | ||
| files: '^solutions/.*Solution\.cpp$' | ||
|
|
||
| - repo: https://github.com/sqlfluff/sqlfluff | ||
| rev: 3.3.0 | ||
| hooks: | ||
| - id: sqlfluff-lint | ||
| name: sqlfluff (oracle) | ||
| files: '\.oraclesql$' | ||
| args: ["--dialect", "oracle"] | ||
|
|
||
| - repo: local | ||
| hooks: | ||
| - id: progress-table | ||
| name: progress table up to date | ||
| entry: python scripts/generate_progress.py --check | ||
| language: system | ||
| pass_filenames: false | ||
| files: '^solutions/|^scripts/generate_progress\.py$' |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this new CI job runs on the current repository, the exact command in this step fails immediately because many existing
solutions/**/Solution.cppfiles are not formatted with the new.clang-formatrules; I ran the samefind ... | clang-format --dry-run --Werrorblock and it reported thousands of violations, including accepted files such assolutions/diagonal-traverse/Accepted/8-26-2023, 10_44_24 AM/Solution.cppandsolutions/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 👍 / 👎.