RepoPilotOpen in app →

yuanguangxin/LeetCode

LeetCode刷题记录与面试整理

Mixed

Slowing — last commit 11mo ago

weakest axis
Use as dependencyConcerns

no license — legally unclear; no tests detected…

Fork & modifyConcerns

no license — can't legally use code; no tests detected…

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isConcerns

no license — can't legally use code; last commit was 11mo ago…

  • Last commit 11mo ago
  • 3 active contributors
  • Slowing — last commit 11mo ago
Show all 8 evidence items →
  • Small team — 3 contributors active in recent commits
  • Single-maintainer risk — top contributor 88% of recent commits
  • No license — legally unclear to depend on
  • No CI workflows detected
  • No test directory detected
What would change the summary?
  • Use as dependency ConcernsMixed if: publish a permissive license (MIT, Apache-2.0, etc.)
  • Fork & modify ConcernsMixed if: add a LICENSE file
  • Deploy as-is ConcernsMixed if: add a LICENSE file

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Great to learn from" badge

Paste into your README — live-updates from the latest cached analysis.

RepoPilot: Great to learn from
[![RepoPilot: Great to learn from](https://repopilot.app/api/badge/yuanguangxin/leetcode?axis=learn)](https://repopilot.app/r/yuanguangxin/leetcode)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/yuanguangxin/leetcode on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: yuanguangxin/LeetCode

Generated by RepoPilot · 2026-05-09 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/yuanguangxin/LeetCode shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

WAIT — Slowing — last commit 11mo ago

  • Last commit 11mo ago
  • 3 active contributors
  • ⚠ Slowing — last commit 11mo ago
  • ⚠ Small team — 3 contributors active in recent commits
  • ⚠ Single-maintainer risk — top contributor 88% of recent commits
  • ⚠ No license — legally unclear to depend on
  • ⚠ No CI workflows detected
  • ⚠ No test directory detected

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live yuanguangxin/LeetCode repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/yuanguangxin/LeetCode.

What it runs against: a local clone of yuanguangxin/LeetCode — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in yuanguangxin/LeetCode | Confirms the artifact applies here, not a fork | | 2 | Default branch master exists | Catches branch renames | | 3 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 4 | Last commit ≤ 365 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>yuanguangxin/LeetCode</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of yuanguangxin/LeetCode. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/yuanguangxin/LeetCode.git
#   cd LeetCode
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of yuanguangxin/LeetCode and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "yuanguangxin/LeetCode(\\.git)?\\b" \\
  && ok "origin remote is yuanguangxin/LeetCode" \\
  || miss "origin remote is not yuanguangxin/LeetCode (artifact may be from a fork)"

# 3. Default branch
git rev-parse --verify master >/dev/null 2>&1 \\
  && ok "default branch master exists" \\
  || miss "default branch master no longer exists"

# 4. Critical files exist
test -f "README.md" \\
  && ok "README.md" \\
  || miss "missing critical file: README.md"
test -f "src/hash相关/q1_两数之和/f1/Solution.java" \\
  && ok "src/hash相关/q1_两数之和/f1/Solution.java" \\
  || miss "missing critical file: src/hash相关/q1_两数之和/f1/Solution.java"
test -f "src/动态规划/q53_最大子序和/f1/Solution.java" \\
  && ok "src/动态规划/q53_最大子序和/f1/Solution.java" \\
  || miss "missing critical file: src/动态规划/q53_最大子序和/f1/Solution.java"
test -f "src/双指针遍历/q42_接雨水/Solution.java" \\
  && ok "src/双指针遍历/q42_接雨水/Solution.java" \\
  || miss "missing critical file: src/双指针遍历/q42_接雨水/Solution.java"
test -f "src/二叉搜索树相关/q98_验证二叉搜索树/f1/Solution.java" \\
  && ok "src/二叉搜索树相关/q98_验证二叉搜索树/f1/Solution.java" \\
  || miss "missing critical file: src/二叉搜索树相关/q98_验证二叉搜索树/f1/Solution.java"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 365 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~335d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/yuanguangxin/LeetCode"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

A systematically organized LeetCode problem collection with 115k+ lines of Java code covering algorithm categories (hash tables, linked lists, trees, dynamic programming, backtracking, etc.). It serves as both a solved problem reference and interview preparation resource, with multiple solution approaches per problem where applicable. Single-tree structure organized by algorithm paradigm: src/ root contains subdirectories (hash相关/, 链表操作/, 树的遍历/, etc.), each holding qN_problem_name/ folders with Solution.java implementations and sometimes helper classes like TreeNode.java or ListNode.java. Some problems (e.g., q98_验证二叉搜索树/) have multiple approaches in f1/, f2/, f3/ subfolders.

👥Who it's for

Computer science students and software engineers preparing for technical interviews or practicing competitive programming, who need categorized, working Java implementations of canonical LeetCode problems with multiple algorithmic approaches.

🌱Maturity & risk

Actively maintained educational repository with comprehensive coverage of ~60+ LeetCode problems organized by algorithm type. No CI/CD pipeline visible (no .github/workflows/ files), and maturity depends on contributor activity frequency, which is not determinable from repo metadata alone. Likely in steady state rather than rapid development.

Low risk for learning purposes: this is a solved-problems reference, not production code, so quality concerns are minimal. Single maintainer (yuanguangxin) means contribution velocity may be slow. No external dependencies visible (pure Java stdlib), eliminating supply-chain risk. Main risk is outdated solutions if LeetCode problem constraints change.

Active areas of work

Repository appears to be in maintenance mode based on visible structure—no active PRs or recent commits shown in provided metadata. Likely receiving occasional additions for newly solved problems, but no major refactoring or feature development visible.

🚀Get running

git clone https://github.com/yuanguangxin/LeetCode.git && cd LeetCode && javac -d . src/hash相关/q1_两数之和/f1/Solution.java (or use IntelliJ IDEA with the provided LeetCode.iml file). No build tool configuration (Maven/Gradle) required—plain Java files.

Daily commands: No runnable application—this is a code reference. To test a specific solution: javac src/hash相关/q1_两数之和/f1/Solution.java && java -cp src hash相关.q1_两数之和.f1.Solution (after package structure is set up). IntelliJ IDEA recommended (LeetCode.iml file present).

🗺️Map of the codebase

  • README.md — Entry point documenting the entire problem categorization system; essential for understanding repo organization and problem classification strategy.
  • src/hash相关/q1_两数之和/f1/Solution.java — Foundation hash table problem with multiple approaches; demonstrates core pattern used throughout the codebase for algorithm design.
  • src/动态规划/q53_最大子序和/f1/Solution.java — Classic dynamic programming problem with multiple solution approaches; exemplifies the multi-solution pattern used across the repo.
  • src/双指针遍历/q42_接雨水/Solution.java — Complex two-pointer/sliding window problem; demonstrates advanced algorithm technique foundational to many problems in the repo.
  • src/二叉搜索树相关/q98_验证二叉搜索树/f1/Solution.java — Tree traversal and validation pattern used across binary tree problem set; establishes BST constraint checking paradigm.
  • src/其他/lru实现/LRUCache.java — System design interview problem implementation; demonstrates practical data structure design beyond typical LeetCode problems.
  • src/回溯法/q46_全排列/f1/Solution.java — Core backtracking pattern; foundational for understanding recursive solution approaches used throughout combinatorics problems.

🛠️How to make changes

Add a New LeetCode Problem Solution

  1. Create a new directory under the appropriate category folder (e.g., src/hash相关/, src/动态规划/, src/双指针遍历/) named as qXXX_problem_name (src/hash相关/q1_两数之和)
  2. Create Solution.java inside the new directory with the main algorithm implementation (src/hash相关/q1_两数之和/f1/Solution.java)
  3. If multiple approaches exist, create f1/, f2/, f3/ subdirectories with different Solution.java implementations for each approach (src/动态规划/q53_最大子序和/f1/Solution.java)
  4. Add supporting classes (TreeNode.java, ListNode.java) if needed for tree/linked list problems (src/二叉搜索树相关/q98_验证二叉搜索树/f1/TreeNode.java)
  5. Update README.md in the root directory to add links to the new problem under the appropriate category section (README.md)

Add a New Algorithm Category

  1. Create a new directory under src/ with a descriptive category name (e.g., src/贪心算法/, src/字符串操作/) (src/字符串操作)
  2. Follow the standard problem directory structure: src/category_name/qXXX_problem_name/Solution.java (src/字符串操作/q6_Z字形变换)
  3. Create supporting data structure classes as needed (TreeNode.java, ListNode.java, etc.) (src/字符串操作/q6_Z字形变换/Solution.java)
  4. Add a new section to README.md with the category name and list of problems with links (README.md)

Document Multiple Solution Approaches

  1. Create base problem directory: src/category/qXXX_problem_name (src/动态规划/q5_最长回文子串)
  2. Create subdirectories f1, f2, f3, etc. for each distinct approach (f1 = brute force, f2 = optimized, etc.) (src/动态规划/q5_最长回文子串/f1/Solution.java)
  3. Implement the algorithm in each Solution.java with clear comments explaining the approach's time/space complexity (src/动态规划/q5_最长回文子串/f2/Solution.java)
  4. Include a brief inline comment in Solution.java comparing time/space complexity with other approaches in the directory (src/动态规划/q53_最大子序和/f1/Solution.java)

🔧Why these technologies

  • Java — Standard LeetCode platform language; allows direct submission and testing on platform; strong type system aids algorithm clarity
  • Git/GitHub — Version control for tracking learning progress; enables branching for different problem categories; supports collaboration and review
  • Markdown (README) — Human-readable documentation and navigation; GitHub renders automatically; easy to maintain problem index and links

⚖️Trade-offs already made

  • Multiple solution approaches stored in f1/, f2/, f3/ subdirectories

    • Why: Demonstrates different algorithm paradigms and complexity tradeoffs for the same problem
    • Consequence: Increases repository size and complexity; requires careful naming/documentation to distinguish approaches
  • Category-based organization (hash相关, 动态规划, etc.) rather than flat structure

    • Why: Helps developers understand problem patterns and solution techniques by grouping related problems
    • Consequence: Requires discipline to place new problems in correct category; some problems could fit multiple categories
  • Minimal code comments and no separate documentation files

    • Why: Encourages code clarity and self-documenting solutions; reduces maintenance burden
    • Consequence: New developers must infer patterns; lacks comprehensive explanation of algorithm intuition

🚫Non-goals (don't propose these)

  • Not a LeetCode platform — does not support interactive problem solving or online judging
  • Not a tutorial site — does not provide detailed written explanations or algorithm theory
  • Not a test suite framework — does not include automated test cases or CI/CD validation
  • Not a package library — not intended for external dependency or reuse in production systems
  • Not language-agnostic — solutions are exclusively in Java, not polyglot

🪤Traps & gotchas

No external dependencies or environment configuration required—pure Java. However: (1) Package structure uses Chinese characters in directory names (hash相关/, q387_字符串中的第一个唯一字符/), which may require UTF-8 terminal support on some systems; (2) No test files (JUnit/TestNG) present—solutions are bare implementations without automated test harnesses; (3) Some problems may have outdated constraints if LeetCode updated problem definitions; (4) No build.gradle or pom.xml—purely source files, requiring manual classpath management in non-IDE environments.

🏗️Architecture

💡Concepts to learn

  • krahets/LeetCode-Book — Chinese-language LeetCode companion with problem classifications and explanations; complementary learning resource for same audience.
  • yangshun/tech-interview-handbook — Comprehensive interview prep guide with algorithm explanations and best practices; ecosystem resource for interview candidates.
  • greyireland/algorithm-pattern — Chinese algorithm pattern encyclopedia covering DP, greedy, backtracking, etc.; parallel reference with more detailed explanations.
  • azl397985856/leetcode — Another popular Chinese LeetCode solutions repo with 100k+ stars; direct competitor with JavaScript/Python alternatives.
  • TheAlgorithms/Java — Broader algorithm implementations (sorting, searching, graph theory) beyond LeetCode; ecosystem companion for foundational algorithm study.

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive JUnit test suite for LeetCode solutions

The repo contains 50+ LeetCode solutions across multiple categories (Hash, Binary Search Tree, Dynamic Programming, etc.) but lacks any visible test files. Adding JUnit tests would improve code reliability, serve as documentation for expected inputs/outputs, and help new contributors understand solution correctness. This is especially valuable since many problems have multiple solution approaches (f1, f2, f3) that should be validated.

  • [ ] Create src/hash相关/q1_两数之和/f1/SolutionTest.java with test cases for both approaches
  • [ ] Create src/二叉搜索树相关/q98_验证二叉搜索树/f1/SolutionTest.java covering all three validation approaches
  • [ ] Create src/动态规划/q53_最大子序和/SolutionTest.java testing both DP approaches
  • [ ] Add Maven/Gradle dependency for JUnit 4 or 5 in pom.xml or build.gradle
  • [ ] Document testing conventions in README.md for contributors

Create unified TreeNode and ListNode base classes to reduce code duplication

The codebase has duplicated TreeNode.java and ListNode.java files across multiple solution directories (e.g., src/二叉搜索树相关/q450_删除二叉搜索树中的节点/TreeNode.java and src/二叉搜索树相关/q701_二叉搜索树中的插入操作/TreeNode.java). Consolidating these into src/utils/TreeNode.java and src/utils/ListNode.java would reduce maintenance burden and improve consistency across all 50+ solutions.

  • [ ] Create src/utils directory structure
  • [ ] Create src/utils/TreeNode.java with generic tree node implementation
  • [ ] Create src/utils/ListNode.java with generic linked list node implementation
  • [ ] Update all imports in src/二叉搜索树相关/* to use the unified TreeNode
  • [ ] Update all imports in src/链表操作/* to use the unified ListNode (if missing)
  • [ ] Document this pattern in CONTRIBUTING.md for new submissions

Add missing problem solutions and update partial README documentation

The README shows a truncated file structure and contains broken/incomplete section links (e.g., the final '### 字符串操作' section is cut off mid-sentence at 'src/字符串'). The file structure shows implemented solutions in src/其他/ and src/分治法/ that aren't listed in the README categories. Creating a complete, auto-generated solution index and fixing broken links would improve navigation and discoverability for the 50+ problems.

  • [ ] Complete the truncated '### 字符串操作' section in README.md with all files from src/字符串操作/
  • [ ] Add missing category '### 其他' to README.md with links to src/其他/* (lru实现, 丢玻璃球, 二叉树遍历, etc.)
  • [ ] Add missing category '### 分治法' to README.md with links to q23, q33, q34 solutions
  • [ ] Add a new '### 快慢指针遍历' section that appears in the partial README snippet
  • [ ] Create a scripts/generate-readme.py script to auto-generate the solution index from directory structure to prevent future desynchronization

🌿Good first issues

  • Add JUnit 5 test classes for each Solution.java file in src/hash相关/ (q1, q387)—currently no unit tests exist, and this would improve verifiability for new contributors.
  • Create a Makefile or build.gradle to automate compilation and testing (repo currently relies on manual javac)—would improve usability for learners without IDE setup.
  • Document time/space complexity analysis in javadoc comments for top-10 most common interview problems (q1, q2, q3, q15, q23, q56, q70, q102, q206, q236)—currently solutions lack complexity annotations.

Top contributors

Click to expand

📝Recent commits

Click to expand
  • 30f3afa — update (guangxin.yuan)
  • e372fd0 — update (guangxin.yuan)
  • a4ebe6c — update (guangxin.yuan)
  • 73cf06a — update (guangxin.yuan)
  • adcef0c — update (guangxin.yuan)
  • 7f426cc — update (guangxin.yuan)
  • ba523eb — add q1920 (guangxin.yuan)
  • 6e56ef6 — Update README.md (yuanguangxin)
  • f58a68d — add etc (yuanguangxin)
  • 13f120e — add etc (yuanguangxin)

🔒Security observations

This is a LeetCode solutions repository with algorithmic implementations. Overall security posture is good as it appears to be educational code without external dependencies, database connections, or network exposure. Primary risks are: (1) lack of visibility into actual dependency versions, (2) absence of provided source code for deeper analysis, and (3) the project does not appear to follow secure coding practices documentation. No critical or high-severity vulnerabilities were identified from the structural analysis alone. Recommend: scanning dependencies with automated tools, reviewing actual source code for secure coding practices, and documenting security guidelines for contributors.

  • Low · Missing FUNDING Configuration — .github/FUNDING.yml. The .github/FUNDING.yml file exists but its contents were not provided for review. This file may contain GitHub sponsorship links or financial information that could be misconfigured. Fix: Review the FUNDING.yml file to ensure no sensitive information is exposed and that any external links are legitimate.
  • Low · No Dependency Management File Detected — Project root. This is a Java project but no pom.xml (Maven) or build.gradle (Gradle) file was provided in the file structure. Without visibility into dependencies, vulnerable libraries cannot be assessed. Fix: Ensure dependency management files (pom.xml or build.gradle) exist and are regularly scanned for vulnerable dependencies using tools like OWASP Dependency-Check or Snyk.
  • Low · Incomplete Static Analysis Due to Missing Source Content — All .java files in src/. Only file structure and names are available. Actual Java source code was not provided for deep analysis of potential code-level vulnerabilities such as buffer overflows, unsafe serialization, or improper input validation. Fix: Perform comprehensive source code review focusing on: input validation, proper exception handling, secure cryptography usage, and thread safety in multithreaded components (e.g., LRUCache.java, Threads.java).

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Mixed signals · yuanguangxin/LeetCode — RepoPilot