-
Notifications
You must be signed in to change notification settings - Fork 1
Problem & Exercise System
The problem system provides coding challenges across 25 programming languages. Each language has its own data file with problems following the Problem interface.
lib/problems/
├── index.ts # Registry + query functions
├── javascript.ts # JavaScript problems
├── typescript.ts # TypeScript problems
├── python.ts # Python problems
├── java.ts, cpp.ts, ... # 21 more language files
└── interview-recommended.ts # Curated interview-essential IDs
└── Selective filtering: 14 core pattern categories, excludes hard difficulty
getProblemsForLanguage(lang) // All problems for a language
getProblemsByCategory(lang, cat) // Filter by category
getProblemsByDifficulty(lang, d) // Filter by difficulty
getCategoriesForLanguage(lang) // Available categories
getRandomProblem(lang) // Random problem
searchProblemsByTag(lang, tag) // Search by tag
getProblemCountByLanguage() // Counts per languageJavaScript / TypeScript: Actual code execution via codeRunner.ts:
-
Function()constructor sandboxing with timeout - Anti-cheat detection (hardcoded output, no method usage, forbidden patterns)
- Deep equality comparison for test case validation
All other languages: Pattern-based validation via validPatterns:
- Each problem defines regex patterns the answer must match
- Validates that the user's code contains the expected syntax/methods
- Cannot verify actual execution (no in-browser runtime for Python, Java, etc.)
- Detects hardcoded output (return value matches expected without computation)
- Checks for required method usage
- Blocks forbidden patterns
- Hidden test cases for additional validation
- Helpful error hints (15+ patterns mapping common errors to friendly messages)
"Building Blocks" exercises provide structured algorithm learning with starter code, test cases, and interactive visualizations.
lib/exercises/
├── types.ts # Exercise types & display configs
├── javascript.ts # JS exercises
├── typescript.ts # TS exercises
├── python.ts # Python exercises
├── javascript-extra.ts # Additional JS exercises
├── typescript-extra.ts # Additional TS exercises
└── tutor-prompt.ts # AI tutor system prompt
| Category | Description |
|---|---|
traversal |
Tree/graph traversal algorithms |
iteration-patterns |
Loops, sliding window, two pointers |
recursion |
Recursive algorithms |
combinatorics |
Permutations, combinations, subsets |
searching |
Binary search, DFS, BFS |
data-structures |
Stacks, queues, heaps, tries |
memoization |
Dynamic programming |
utilities |
Helper functions and patterns |
- Learn tab: Explanation + AI tutor (WebLLM)
- Practice tab: Monaco Editor + test runner
- Visualization: Lazy-loaded step-through animation (100+ visualizations)
- Test runner: In-browser execution with pass/fail feedback
Multiple-choice questions about language methods/APIs. Generated from method data with auto-generated distractor options.
170 algorithm pattern recognition problems. User reads a problem description and identifies which algorithm pattern to use.
50+ patterns including: Two Pointers, Sliding Window, Binary Search, BFS, DFS, Dynamic Programming, Backtracking, Greedy, Divide and Conquer, Topological Sort, Union Find, Trie, Heap, Stack, etc.
Time/space complexity questions. 10 categories with auto-generated distractor options from a standard complexities pool.
lib/regexTrainer/
├── index.ts # Public API
├── types.ts # Types
├── problems.ts # Regex problems
├── matcher.ts # Evaluation engine
└── cheatsheet.ts # Regex reference data
Character Classes, Quantifiers, Anchors, Groups & Alternation, Lookaround, Common Patterns, Escaping & Special
- User sees a text block with target matches highlighted
- User writes a regex pattern
-
evaluateRegex()computes correct matches, false positives, missed matches - Feedback shows precision/recall of the regex
- 72 algorithm problems across 22 patterns
- 28 system design questions
- Progressive hint system (4 escalation levels)
- Frontend drill problems with selective Interview Recommended filter (8 core categories, excludes hard difficulty)
-
InterviewConfigwith adaptive difficulty - Conversation management for multi-turn AI interaction
- Prompt engineering optimized for token efficiency (~30% reduction)
- WebLLM (local) or OpenAI (cloud) for AI responses
- Curated Interview Recommended selection (14 core algorithm patterns, 8 core frontend categories, hard difficulty excluded)