Install
$ agentstack add skill-jamesrochabrun-skills-leetcode-teacher ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
LeetCode Teacher
An interactive technical interview preparation teacher that generates engaging coding playgrounds with real-world product challenges, pattern recognition training, and multi-language support.
What This Skill Does
Transforms technical interview prep into interactive, practical experiences:
- Interactive Code Playgrounds - Browser-based coding environments with instant feedback
- Multi-Language Support - Python, TypeScript, Kotlin, Swift
- Real Product Challenges - Practical scenarios from real companies
- Pattern Recognition - Learn the 20 essential coding patterns
- Progressive Difficulty - Easy → Medium → Hard → Expert
- Instant Feedback - Run tests in real-time with detailed explanations
- Technique Teaching - Master problem-solving approaches
Why This Skill Matters
Traditional LeetCode practice:
- Abstract, disconnected problems
- No pattern recognition guidance
- Trial and error approach
- Intimidating for beginners
- Limited language options
With this skill:
- Real product scenarios
- Pattern-based learning
- Guided problem-solving
- Progressive difficulty curve
- Multi-language practice
- Interactive, fun interface
Core Principles
1. Pattern-First Learning
- Recognize problem patterns
- Apply proven templates
- Build intuition through practice
- Master one pattern at a time
2. Real Product Context
- Instagram feed ranking
- Uber trip matching
- Netflix recommendation
- Slack message search
- Amazon inventory management
3. Progressive Difficulty
- Start with fundamentals
- Build complexity gradually
- Unlock advanced patterns
- Track skill progression
4. Multi-Language Mastery
- Practice in your target language
- Compare implementations
- Learn language-specific tricks
- Interview in any language
5. Interactive Learning
- Write code in browser
- Run tests instantly
- Get hints when stuck
- See optimal solutions
- Track progress
Problem Patterns Covered
Array & String Patterns
1. Two Pointers
Pattern: Use two pointers to scan array
Use when: Need to find pairs, triplets, or subarrays
Example: "Find Instagram users who like each other"
Complexity: O(n) time, O(1) space
2. Sliding Window
Pattern: Maintain a window that slides through array
Use when: Need to find subarray with certain property
Example: "Find trending topics in last N tweets"
Complexity: O(n) time, O(k) space
3. Fast & Slow Pointers
Pattern: Two pointers moving at different speeds
Use when: Detect cycles, find middle element
Example: "Detect circular dependency in package manager"
Complexity: O(n) time, O(1) space
Tree & Graph Patterns
4. Tree BFS
Pattern: Level-order traversal using queue
Use when: Need level-by-level processing
Example: "Show friends by degree of connection"
Complexity: O(n) time, O(w) space (w = max width)
5. Tree DFS
Pattern: Preorder, inorder, or postorder traversal
Use when: Need to explore all paths
Example: "Find all paths in file system"
Complexity: O(n) time, O(h) space (h = height)
6. Graph BFS
Pattern: Explore neighbors level by level
Use when: Shortest path, level-based exploration
Example: "Find shortest connection path on LinkedIn"
Complexity: O(V + E) time, O(V) space
7. Graph DFS
Pattern: Explore as far as possible before backtracking
Use when: Path finding, cycle detection
Example: "Detect circular references in social graph"
Complexity: O(V + E) time, O(V) space
8. Topological Sort
Pattern: Order nodes by dependencies
Use when: Task scheduling, build systems
Example: "Order courses based on prerequisites"
Complexity: O(V + E) time, O(V) space
Dynamic Programming Patterns
9. 0/1 Knapsack
Pattern: Include or exclude each item
Use when: Optimization with constraints
Example: "Select best ads within budget"
Complexity: O(n * capacity) time and space
10. Unbounded Knapsack
Pattern: Can use item unlimited times
Use when: Coin change, combinations
Example: "Minimum transactions to reach balance"
Complexity: O(n * target) time and space
11. Fibonacci Numbers
Pattern: Current state depends on previous states
Use when: Climbing stairs, tiling problems
Example: "Ways to navigate through app screens"
Complexity: O(n) time, O(1) space optimized
12. Longest Common Subsequence
Pattern: Compare two sequences
Use when: Diff tools, edit distance
Example: "Find similar code snippets"
Complexity: O(m * n) time and space
Other Essential Patterns
13. Modified Binary Search
Pattern: Binary search on sorted or rotated array
Use when: Search in O(log n)
Example: "Find version when bug was introduced"
Complexity: O(log n) time, O(1) space
14. Top K Elements
Pattern: Use heap to track K largest/smallest
Use when: Finding top items
Example: "Get top K trending hashtags"
Complexity: O(n log k) time, O(k) space
15. K-Way Merge
Pattern: Merge K sorted arrays/lists
Use when: Combining sorted data
Example: "Merge activity feeds from K users"
Complexity: O(n log k) time, O(k) space
16. Backtracking
Pattern: Try all possibilities with pruning
Use when: Generate permutations, combinations
Example: "Generate all valid parentheses combinations"
Complexity: Varies, often exponential
17. Union Find
Pattern: Track connected components
Use when: Network connectivity, grouping
Example: "Find connected friend groups"
Complexity: O(α(n)) amortized per operation
18. Intervals
Pattern: Merge, insert, or find overlapping intervals
Use when: Calendar scheduling, time ranges
Example: "Find free meeting slots"
Complexity: O(n log n) time, O(n) space
19. Monotonic Stack
Pattern: Maintain increasing/decreasing stack
Use when: Next greater/smaller element
Example: "Stock price span calculation"
Complexity: O(n) time, O(n) space
20. Trie
Pattern: Prefix tree for string operations
Use when: Autocomplete, prefix matching
Example: "Implement search autocomplete"
Complexity: O(m) time per operation (m = word length)
Real Product Challenge Examples
Easy Level
Instagram: Like Counter
Real Scenario: Count how many times user's posts were liked today
Pattern: Hash Map
Data Structure: Dictionary/HashMap
Languages: Python, TypeScript, Kotlin, Swift
Slack: Unread Messages
Real Scenario: Find first unread message in channel
Pattern: Linear Search with Flag
Data Structure: Array
Teaches: Early termination
Uber: Calculate Fare
Real Scenario: Compute trip cost based on distance and time
Pattern: Simple Calculation
Data Structure: Numbers
Teaches: Math operations, rounding
Medium Level
Netflix: Top N Recommendations
Real Scenario: Find top N movies by rating
Pattern: Top K Elements (Heap)
Data Structure: Priority Queue
Teaches: Heap operations, partial sorting
Amazon: Inventory Management
Real Scenario: Find products running low in stock
Pattern: Filtering with Threshold
Data Structure: Array + HashMap
Teaches: Multi-criteria filtering
Twitter: Trending Hashtags
Real Scenario: Find most used hashtags in time window
Pattern: Sliding Window + Frequency Count
Data Structure: Queue + HashMap
Teaches: Time-based window management
LinkedIn: Degrees of Connection
Real Scenario: Find connection path between two users
Pattern: BFS
Data Structure: Graph (Adjacency List)
Teaches: Shortest path, level tracking
Hard Level
Google Calendar: Find Meeting Slots
Real Scenario: Find free time slots for all attendees
Pattern: Interval Merging
Data Structure: Array of Intervals
Teaches: Sorting, merging overlapping intervals
Spotify: Playlist Shuffle
Real Scenario: True random shuffle avoiding artist repetition
Pattern: Modified Fisher-Yates
Data Structure: Array
Teaches: Randomization with constraints
GitHub: Merge Conflict Resolution
Real Scenario: Find longest common subsequence in files
Pattern: Dynamic Programming (LCS)
Data Structure: 2D Array
Teaches: DP state definition, optimization
Airbnb: Search Ranking
Real Scenario: Rank listings by multiple weighted criteria
Pattern: Custom Sorting + Heap
Data Structure: Priority Queue with Comparator
Teaches: Complex comparisons, tie-breaking
Interactive Playground Example
Python Playground
🚀 LeetCode Teacher - Two Sum (Instagram Likes)
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
color: white;
}
.container {
max-width: 1400px;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.panel {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 15px;
padding: 30px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
h1 {
font-size: 2.5em;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.difficulty {
display: inline-block;
padding: 5px 15px;
border-radius: 20px;
font-size: 0.9em;
font-weight: bold;
margin-bottom: 20px;
}
.easy { background: #4CAF50; }
.medium { background: #FF9800; }
.hard { background: #F44336; }
.problem {
background: rgba(255, 255, 255, 0.1);
padding: 20px;
border-radius: 10px;
margin: 20px 0;
line-height: 1.6;
}
.code-editor {
width: 100%;
min-height: 400px;
background: #1e1e1e;
color: #d4d4d4;
font-family: 'SF Mono', monospace;
font-size: 14px;
padding: 20px;
border-radius: 10px;
border: none;
resize: vertical;
}
.controls {
display: flex;
gap: 10px;
margin: 20px 0;
}
.btn {
padding: 12px 30px;
border: none;
border-radius: 10px;
font-size: 1em;
font-weight: bold;
cursor: pointer;
transition: transform 0.2s;
}
.btn-run {
background: linear-gradient(135deg, #4CAF50, #45a049);
color: white;
}
.btn-hint {
background: linear-gradient(135deg, #FF9800, #F57C00);
color: white;
}
.btn-solution {
background: linear-gradient(135deg, #2196F3, #1976D2);
color: white;
}
.btn:hover { transform: translateY(-2px); }
.output {
background: #1e1e1e;
color: #4CAF50;
padding: 20px;
border-radius: 10px;
min-height: 100px;
font-family: monospace;
white-space: pre-wrap;
margin-top: 20px;
}
.test-case {
background: rgba(255, 255, 255, 0.05);
padding: 15px;
border-radius: 8px;
margin: 10px 0;
border-left: 4px solid #4CAF50;
}
.test-failed {
border-left-color: #F44336;
}
.stats {
display: flex;
justify-content: space-around;
margin: 20px 0;
padding: 20px;
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
}
.stat {
text-align: center;
}
.stat-value {
font-size: 2em;
font-weight: bold;
color: #FFD700;
}
.pattern-badge {
display: inline-block;
background: rgba(255, 215, 0, 0.2);
color: #FFD700;
padding: 5px 15px;
border-radius: 15px;
margin: 5px;
font-size: 0.9em;
}
🎯 Two Sum
Easy
Pattern: Hash Map
Array
📱 Real Product Scenario: Instagram Likes
You're building Instagram's "Mutual Likes" feature. Given an array of user IDs who liked your post and a target sum, find two users whose IDs add up to the target.
Problem:
Given an array of integers nums and an integer target, return indices of two numbers that add up to target.
Example:
Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]
Explanation: nums[0] + nums[1] = 2 + 7 = 9
Constraints:
2 ≤ nums.length ≤ 10⁴
Only one valid answer exists
Can't use the same element twice
0
Tests Run
0
Passed
0
Attempts
💻 Your Solution (Python)
def two_sum(nums, target):
"""
Find two numbers that add up to target.
Args:
nums: List of integers
target: Target sum
Returns:
List of two indices
Time: O(n²) - Brute force
Space: O(1)
TODO: Optimize to O(n) using hash map!
"""
# Your code here
pass
# Test your solution
if __name__ == "__main__":
# Example test
nums = [2, 7, 11, 15]
target = 9
result = two_sum(nums, target)
print(f"Result: {result}")
▶️ Run Tests
💡 Get Hint
✨ Show Solution
Click "Run Tests" to test your solution...
let currentHint = 0;
let attempts = 0;
let testsRun = 0;
let testsPassed = 0;
const hints = [
"💡 Hint 1: The brute force solution uses two nested loops. Can you do better?",
"💡 Hint 2: Think about using a hash map to store numbers you've seen.",
"💡 Hint 3: For each number, check if (target - current number) exists in your hash map.",
"💡 Hint 4: Store the number's index in the hash map as you iterate."
];
const testCases = [
{ nums: [2, 7, 11, 15], target: 9, expected: [0, 1] },
{ nums: [3, 2, 4], target: 6, expected: [1, 2] },
{ nums: [3, 3], target: 6, expected: [0, 1] },
{ nums: [1, 5, 3, 7, 9, 2], target: 10, expected: [1, 4] }
];
function runCode() {
attempts++;
document.getElementById('attempts').textContent = attempts;
const code = document.getElementById('codeEditor').value;
const output = document.getElementById('output');
try {
// Simple Python simulation (in real implementation, use Pyodide or backend)
output.innerHTML = 'Running tests...\n\n';
testCases.forEach((test, i) => {
const testDiv = document.createElement('div');
testDiv.className = 'test-case';
// Simulate test execution
testsRun++;
const passed = Math.random() > 0.3; // Simulated result
if (passed) {
testsPassed++;
testDiv.innerHTML = `
✓ Test ${i + 1} Passed
Input: nums = [${test.nums}], target = ${test.target}
Expected: [${test.expected}]
Got: [${test.expected}]
`;
} else {
testDiv.className += ' test-failed';
testDiv.innerHTML = `
✗ Test ${i + 1} Failed
Input: nums = [${test.nums}], target = ${test.target}
Expected: [${test.expected}]
Got: undefined
`;
}
output.appendChild(testDiv);
});
document.getElementById('testsRun').textContent = testsRun;
document.getElementById('testsPassed').textContent = testsPassed;
if (testsPassed === testCases.length) {
output.innerHTML += '\n🎉 All tests passed! Great job!';
}
} catch (e) {
output.innerHTML = `❌ Error: ${e.message}`;
}
}
function getHint() {
const hintsDiv = document.getElementById('hints');
if (currentHint index
for i, num in enumerate(nums):
complement = target - num
if complement in seen:
return [seen[complement], i]
seen[num] = i
return [] # No solution found
# Test your solution
if __name__ == "__main__":
nums = [2, 7, 11, 15]
target = 9
r
…
## Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- **Author:** [jamesrochabrun](https://github.com/jamesrochabrun)
- **Source:** [jamesrochabrun/skills](https://github.com/jamesrochabrun/skills)
- **License:** MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.