awangdev/leet-code
Java Solutions to problems on LintCode/LeetCode
Slowing — last commit 5mo ago
weakest axisno license — legally unclear; single-maintainer (no co-maintainers visible)…
no license — can't legally use code; no tests detected…
Documented and popular — useful reference codebase to read through.
no license — can't legally use code; no CI workflows detected
- ✓Last commit 5mo ago
- ⚠Slowing — last commit 5mo ago
- ⚠Solo or near-solo (1 contributor active in recent commits)
Show all 6 evidence items →Show less
- ⚠No license — legally unclear to depend on
- ⚠No CI workflows detected
- ⚠No test directory detected
What would change the summary?
- →Use as dependency Concerns → Mixed if: publish a permissive license (MIT, Apache-2.0, etc.)
- →Fork & modify Concerns → Mixed if: add a LICENSE file
- →Deploy as-is Concerns → Mixed 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.
[](https://repopilot.app/r/awangdev/leet-code)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/awangdev/leet-code on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: awangdev/leet-code
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:
- 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. - 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.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/awangdev/leet-code 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 5mo ago
- Last commit 5mo ago
- ⚠ Slowing — last commit 5mo ago
- ⚠ Solo or near-solo (1 contributor active in 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 awangdev/leet-code
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/awangdev/leet-code.
What it runs against: a local clone of awangdev/leet-code — 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 awangdev/leet-code | 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 ≤ 182 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of awangdev/leet-code. If you don't
# have one yet, run these first:
#
# git clone https://github.com/awangdev/leet-code.git
# cd leet-code
#
# 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 awangdev/leet-code and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "awangdev/leet-code(\\.git)?\\b" \\
&& ok "origin remote is awangdev/leet-code" \\
|| miss "origin remote is not awangdev/leet-code (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 "Java/1. Two Sum.java" \\
&& ok "Java/1. Two Sum.java" \\
|| miss "missing critical file: Java/1. Two Sum.java"
test -f "Java/207. Course Schedule.java" \\
&& ok "Java/207. Course Schedule.java" \\
|| miss "missing critical file: Java/207. Course Schedule.java"
test -f "Java/146. LRU Cache.java" \\
&& ok "Java/146. LRU Cache.java" \\
|| miss "missing critical file: Java/146. LRU Cache.java"
test -f "GenerateCodeTable.java" \\
&& ok "GenerateCodeTable.java" \\
|| miss "missing critical file: GenerateCodeTable.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 182 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~152d)"
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/awangdev/leet-code"
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).
⚡TL;DR
A curated collection of 1000+ Java solutions to LeetCode and LintCode algorithm problems, organized by problem number with detailed implementations covering arrays, trees, graphs, dynamic programming, and backtracking. It serves as a personal study archive and quick-reference guide for algorithmic problem-solving patterns. Flat file structure under Java/ directory with individual .java files named by problem number and title (e.g., Java/1. Two Sum.java, Java/124. Binary Tree Maximum Path Sum.java). Companion markdown files (README.md, ReviewPage.md, KnowledgeHash2.md, SystemDesign.md) provide problem index, summaries, and knowledge notes. Root contains a GenerateCodeTable.java utility for automation.
👥Who it's for
Software engineering interview candidates and competitive programmers preparing for technical interviews, who need working Java implementations of classic algorithm problems with time/space complexity annotations.
🌱Maturity & risk
Actively maintained personal project with 7+ years of history and substantial depth (3.1MB of Java code). No formal CI/CD pipeline visible (.github/FUNDING.yml exists but no workflows), no test files in the listing, and maintenance appears episodic ('当年...积累'/'come to maintain when leisure'). Verdict: reference-quality learning resource, not production software.
Single-maintainer personal archive with no automated testing infrastructure or dependency management visible (no pom.xml, build.gradle, or package.json). Risk of stale solutions as LeetCode/LintCode API changes; no versioning or changelog evident. Breaking changes to problem statements on the platforms would silently invalidate solutions.
Active areas of work
No recent commit metadata visible in provided data. Repository appears to be in maintenance mode with periodic updates. The GenerateCodeTable.java suggests occasional bulk updates to documentation (likely regenerating README tables). No active PRs or issue tracking visible.
🚀Get running
git clone https://github.com/awangdev/leet-code.git
cd leet-code
# No build required; open Java files directly in IDE (IntelliJ IDEA, VSCode with Extension Pack for Java recommended)
java Java/"1. Two Sum.java" # Example: run a solution
Daily commands:
No build system; solutions are standalone Java files. Run individually via javac + java or copy code into your IDE's leetcode plugin:
javac "Java/1. Two Sum.java"
java 'Two Sum'
Alternatively, copy solution into LeetCode's online judge or a local test harness.
🗺️Map of the codebase
README.md— Central index documenting all 600+ solved problems with difficulty levels, tags, and time/space complexity — essential reference for navigating the solution collection.Java/1. Two Sum.java— Foundational two-pointer/hash map pattern that appears repeatedly across the codebase; study this to understand the repo's documentation and solution style conventions.Java/207. Course Schedule.java— Demonstrates graph-based topological sorting; critical for understanding dependency-based algorithm patterns used throughout the hard-tier problems.Java/146. LRU Cache.java— Complex data structure design combining HashMap and doubly-linked list; showcases the repo's approach to explaining intricate algorithmic patterns.GenerateCodeTable.java— Build utility that generates the markdown problem index; required to understand how the README is maintained and how to add new problems.ReviewPage.md— Comprehensive summary and categorization of all solutions by algorithm type and technique; essential for pattern recognition across the problem set.KnowledgeHash2.md— Aggregated knowledge notes on core data structures and algorithms; critical conceptual reference for understanding the reasoning behind multiple solutions.
🧩Components & responsibilities
- Java Solution Files (Java 8+, standard library only) — Implement algorithm logic with inline comments explaining approach, time, and space complexity
- Failure mode: Runtime error or wrong answer when submitted to LeetCode; developer debugs via test case inspection
- GenerateCodeTable.java (Java Reflection, File I/O, String manipulation) — Scans Java/ directory, extracts metadata (problem number, complexity, tags) from javadoc comments, regenerates README.md table
- Failure mode: Missing or malformed complexity annotations in solution files cause incomplete table entries; rebuild and manual review
🛠️How to make changes
Add a New LeetCode Problem Solution
- Create a new Java file in Java/ directory named with problem number and title (e.g., 'Java/246. Shortest Word Distance IV.java') (
Java/{number}. {Problem Title}.java) - Write solution class with comments documenting approach, time complexity (O(?) notation), and space complexity (
Java/{number}. {Problem Title}.java) - Document the solution with @param, @return, and algorithm explanation comments matching existing solution style (see Java/1. Two Sum.java) (
Java/{number}. {Problem Title}.java) - Run GenerateCodeTable.java to regenerate README.md with the new problem entry (
GenerateCodeTable.java) - Add high-level algorithm classification notes to ReviewPage.md categorizing the problem by technique (Array, Graph, DP, etc.) (
ReviewPage.md)
Understand a Specific Algorithm Pattern
- Consult ReviewPage.md to identify which problems use the target pattern (e.g., 'Two Pointers', 'Topological Sort') (
ReviewPage.md) - Select a problem marked as Medium difficulty from README.md as a learning starting point (
README.md) - Study the reference solution to understand the core algorithm and complexity reasoning (
Java/{Problem}.java) - Review conceptual notes in KnowledgeHash2.md for the specific data structure (e.g., HashMap, Trie, Graph representation) (
KnowledgeHash2.md)
Prepare for Coding Interview on a Topic
- Identify topic area in ReviewPage.md (e.g., 'Binary Trees', 'Graphs & DFS/BFS') (
ReviewPage.md) - Solve Easy problems from README.md in that category to build foundational fluency (
README.md) - Study 2–3 Medium problems from the category with detailed code walkthroughs (
Java/{Problem}.java) - Reference KnowledgeHash2.md for edge cases and common pitfalls in that algorithm domain (
KnowledgeHash2.md)
🔧Why these technologies
- Java — Language-agnostic problem repository with focus on JVM ecosystem; Java's strong typing and verbose syntax makes solutions self-documenting for learning.
- GitHub + Markdown — Provides free, version-controlled hosting with built-in readme rendering; markdown enables easy navigation via table of contents and links.
- Java Reflection (GenerateCodeTable.java) — Automates maintenance burden of synchronizing 600+ problem entries; prevents manual README drift as solutions are added/modified.
⚖️Trade-offs already made
-
Single Java/ directory with flat namespace rather than topic-based subdirectories
- Why: Simplifies file enumeration in GenerateCodeTable.java; enables quick lexicographic access to problem numbers.
- Consequence: 600+ files in one folder can feel unorganized; rely on ReviewPage.md for topic-based categorization instead.
-
No unit tests or test harness infrastructure
- Why: Focus is on problem-solving patterns and explanation rather than production code quality; reduces maintenance overhead.
- Consequence: Solutions are not automatically validated; correctness depends on manual LeetCode submission testing.
-
Comments and README as primary documentation rather than javadoc API generation
- Why: These are educational solutions, not libraries; inline explanations are more valuable than formal API docs.
- Consequence: No auto-generated docs site; developer must read raw Java files to understand solutions.
🚫Non-goals (don't propose these)
- Not a production-ready algorithm library (no error handling, input validation, or thread safety)
- Not a compiler or runtime (Java files must be compiled and executed in standard JVM environment)
- Not a real-time competitive coding judge (no automatic solution verification or ranking)
- Not a multi-language repository (Java-only; other languages excluded from scope)
🪤Traps & gotchas
- File naming quirk: Problem titles in filenames have leading numbers (e.g.,
1. Two Sum.java), requiring proper escaping in shell commands or IDE navigation. - No test harness: Solutions are verification-ready for online judges but lack local unit tests; you must manually test or copy into LeetCode.
- No complexity validation: Stated time/space in README may drift from actual solution if manually edited; trust code over metadata.
- Markdown encoding: Special characters in filenames (parentheses, colons) may break file links in some markdown renderers; GitHub handles it but local tools may fail.
- No build config: IDEs must be configured to compile individual files; no Maven/Gradle setup to automate dependencies (though none are used).
🏗️Architecture
💡Concepts to learn
- Dynamic Programming Memoization — Eliminates redundant subproblem computation (core to problems like Longest String Chain, House Robber III); essential for optimizing recursion from exponential to polynomial time.
- Two-Pointer / Sliding Window — Reduces O(n²) brute force to O(n) for array/string problems (e.g., Best Time to Buy and Sell Stock); appears in ~15% of easy-medium problems.
- Depth-First Search (DFS) Post-Order Traversal — Required for bottom-up tree computation (Binary Tree Maximum Path Sum, House Robber III); distinguishes it from pre-order and in-order traversals needed for other tree problems.
- Backtracking & Permutation Generation — Solves constraint satisfaction problems (Palindrome Partitioning, Restore IP Addresses) by systematically exploring and pruning decision trees.
- Binary Search Tree (BST) Properties — Enables O(log n) lookups and in-order traversal to extract sorted sequences (Inorder Successor in BST, Construct BST from Preorder); foundation for balanced variants (AVL, Red-Black).
- Bit Manipulation Patterns — Solves space-efficient counting and toggle problems (Missing Number, Convert Integer A to B); XOR used as a 'toggle' primitive.
- Interval Scheduling / Greedy Selection — Used in Stock Trading problems (Best Time to Buy and Sell Stock II) and Jump Game II; greedy choice property avoids DP when optimal substructure permits.
🔗Related repos
labuladong/fucking-algorithm— Chinese-language algorithm problem guide with visual explanations and Java solutions; complementary high-level intuitions for same problem set.greyireland/algorithm-pattern— Algorithm pattern reference (sliding window, binary search, DP checklists) in Chinese/English; pairs well with this repo's solution collection.doocs/leetcode— Multi-language (Java/C++/Go/Python) LeetCode solutions with detailed explanations; useful for cross-checking approaches and learning alternative language idioms.0xADADA/awesome-algorithmic-interview— Curated reading list and resources on algorithm interview prep; bridges gap between this solution collection and conceptual foundations.donnemartin/interactive-coding-challenges— Interactive Jupyter notebooks for algorithm problems with test suites; complements this repo's static solutions with executable learning environment.
🪄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.
Complete the truncated README.md table and add missing problem entries
The README.md snippet shows the table is cut off mid-entry. The repo contains 160+ Java files but the table appears incomplete. A contributor should parse all Java files in the /Java directory, extract problem metadata (LeetCode number, difficulty, tags, complexity), and generate a complete, sortable markdown table. This improves discoverability and makes the repo more maintainable as new solutions are added.
- [ ] Update GenerateCodeTable.java to parse all .java files and extract class/method documentation
- [ ] Extract LeetCode problem numbers, difficulty levels, and algorithm tags from each solution file
- [ ] Regenerate the complete README.md table with all 160+ problems in consistent format
- [ ] Verify table is sortable by LeetCode#, Level, and Tags columns
- [ ] Add a script to /Java directory to auto-update the table on new file additions
Add comprehensive unit tests for binary tree traversal solutions (100-145 series)
The repo contains many tree solutions (Same Tree, Binary Tree Level Order Traversal, Zigzag traversal, Preorder/Postorder traversal, etc.) but no corresponding test files. Creating a /Java/Tests directory with JUnit test cases for these would help new contributors verify correctness and serve as executable documentation of expected behavior.
- [ ] Create /Java/Tests directory structure with TreeTestBase class for common test utilities
- [ ] Write JUnit tests for Binary Tree problems: 100, 102, 103, 104, 111, 114, 124, 144, 145
- [ ] Include edge cases: null trees, single nodes, unbalanced trees, and large trees
- [ ] Add Maven or Gradle configuration to /pom.xml or /build.gradle for test execution
- [ ] Document test execution in README.md with instructions for running:
mvn test
Create ReviewPage.md outline and populate it with solution walkthroughs for high-difficulty problems
The README mentions ReviewPage.md exists but it's not included in the file structure shown. This file should contain categorized problem explanations and solution approaches. Starting with Hard-tier problems (10, 124, 140, 149, etc.) would provide high value - these need explanation beyond code comments.
- [ ] Create /ReviewPage.md with sections organized by problem category (Trees, DP, Greedy, etc.)
- [ ] Write detailed walkthroughs for 5-10 Hard problems: Regular Expression Matching (10), Binary Tree Maximum Path Sum (124), Word Break II (140), Max Points on a Line (149)
- [ ] Include: problem constraints, intuition, algorithmic approach, time/space complexity analysis, and code explanation
- [ ] Link each solution back to the corresponding .java file in Java/ directory
- [ ] Add a 'Common Patterns' section summarizing DFS/BFS, DP memoization, and greedy strategies seen across solutions
🌿Good first issues
- Add unit test harness (e.g., JUnit 5 tests) for 20 fundamental problems (Two Sum, Median of Two Sorted Arrays, Longest Substring Without Repeating Characters) to validate correctness and document expected inputs/outputs.
- Extract common utility methods (TreeNode builder, graph adjacency list helper, DP table initialization) into a
Java/Util.javafile and refactor 10+ solutions to use it, reducing duplication. - Expand
KnowledgeHash2.mdwith 5 new sections on missing topics visible in the problem list: 'Trie Construction' (seen in Longest String Chain), 'Union-Find/DSU' (for graph connectivity), and 'Segment Trees' (for range queries).
📝Recent commits
Click to expand
Recent commits
b5ffd5a— adding FUNDING.yml (awangdev)11cb377— Update README.md (awangdev)ee875b4— Delete LFU Cache.java (awangdev)d82fbfc— Update README.md (awangdev)2f27ecd— Update README.md (awangdev)c201a63— Update README.md (awangdev)ebf5929— Update README.md (awangdev)5868b8d— Update README.md (awangdev)a3c1e56— Update README.md (awangdev)e9a7fbd— Update README.md (awangdev)
🔒Security observations
This repository is a LeetCode/LintCode solutions collection in Java with minimal security concerns. It is primarily an educational resource containing algorithm problem solutions without external dependencies, credentials, or infrastructure components. The codebase follows good security practices for its purpose. Minor recommendations include adding security documentation and ensuring code review processes.
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.