|
| 1 | +# CLAUDE.md - Code Review Guidelines |
| 2 | + |
| 3 | +## Repository Purpose |
| 4 | +This repository contains LeetCode problem solutions for learning and practicing algorithmic problem-solving. Solutions are primarily written in JavaScript/TypeScript. |
| 5 | + |
| 6 | +## Code Review Focus |
| 7 | + |
| 8 | +### 1. Algorithm Correctness |
| 9 | +- Verify the solution correctly solves the problem for all test cases |
| 10 | +- Check for edge cases: empty arrays, single elements, negative numbers, null values |
| 11 | +- Confirm the solution handles constraints mentioned in the problem |
| 12 | + |
| 13 | +### 2. Time & Space Complexity |
| 14 | +- Always analyze and comment on time complexity (Big O notation) |
| 15 | +- Always analyze and comment on space complexity |
| 16 | +- Suggest optimizations if a more efficient approach exists |
| 17 | +- Compare to optimal solutions when applicable |
| 18 | + |
| 19 | +### 3. Code Quality |
| 20 | +- Use clear, descriptive variable names (not just `i`, `j`, `k` unless in simple loops) |
| 21 | +- Add comments for non-obvious logic or algorithm steps |
| 22 | +- Keep functions focused and single-purpose |
| 23 | +- Prefer readability over cleverness |
| 24 | + |
| 25 | +### 4. JavaScript/TypeScript Best Practices |
| 26 | +- Use `const` by default, `let` only when reassignment needed |
| 27 | +- Avoid `var` |
| 28 | +- Use modern ES6+ syntax (arrow functions, destructuring, spread operators) |
| 29 | +- Prefer built-in methods (`.map()`, `.filter()`, `.reduce()`) when appropriate |
| 30 | +- Use strict equality (`===`) over loose equality (`==`) |
| 31 | + |
| 32 | +### 5. Problem-Specific Patterns |
| 33 | +When reviewing graph problems: |
| 34 | +- Verify proper graph representation (adjacency list/matrix) |
| 35 | +- Check for visited tracking to avoid cycles |
| 36 | +- Confirm DFS/BFS implementation follows standard patterns |
| 37 | +- Look for Union-Find correctness if applicable |
| 38 | + |
| 39 | +When reviewing array/string problems: |
| 40 | +- Check for two-pointer technique correctness |
| 41 | +- Verify sliding window boundaries |
| 42 | +- Confirm hash map usage is optimal |
| 43 | + |
| 44 | +### 6. README Requirements |
| 45 | +Each problem solution should include: |
| 46 | +- Problem description or link to LeetCode problem |
| 47 | +- Approach explanation |
| 48 | +- Time and space complexity analysis |
| 49 | +- Any key insights or learnings |
| 50 | + |
| 51 | +## What NOT to Flag |
| 52 | +- Multiple solution approaches (exploratory learning is encouraged) |
| 53 | +- Console.log statements (used for debugging/learning) |
| 54 | +- Less optimal solutions if clearly marked as alternative approaches |
| 55 | + |
| 56 | +## Tone |
| 57 | +Keep feedback constructive and educational. This is a learning repository, so explain *why* something could be improved, not just *what* to change. |
0 commit comments