A smart LeetCode practice tracker that uses the SM-2 spaced repetition algorithm to optimize your coding interview preparation. The system tracks your progress on different question patterns and schedules reviews based on your performance.
- 📊 Pattern-Based Tracking: Track progress by question patterns (e.g., Two Pointers, Dynamic Programming, etc.)
- 🧠 Spaced Repetition: Uses the SM-2 algorithm to schedule optimal review times
- ⏱️ Performance Metrics: Track solving time, difficulty, and success rate
- 📅 Daily Reviews: Automated scheduling of questions that need review
- 📈 Progress History: Complete history of all attempts and improvements
The application uses SQLite with two main tables:
Tracks user progress for each question pattern using the SM-2 algorithm:
- SM-2 Fields:
easiness,interval,repetitions,next_review_date - Progress Fields:
passed,time_in_minutes,last_reviewed_at - Pattern Info:
question_pattern,last_question_name,difficulty
Stores complete history of all question attempts:
- Question Info:
question_name,question_pattern,difficulty - Performance:
passed,time_in_minutes,quality_score - Metadata:
submission_date
1. User submits question attempt → POST /api/submit-review
↓
2. Calculate quality score from (difficulty + time + passed)
↓
3. Run SM-2 algorithm → Get next review date
↓
4. Save to database (user_pattern_progress + review_history)
↓
5. Daily cron job checks next_review_date <= today
↓
6. Return list of questions to review → GET /api/reviews/today/:userId
npm install# Create the SQLite database from schema
sqlite3 leetcode-tracker.db < src/init_db.sql
# Verify the database was created
sqlite3 leetcode-tracker.db ".tables"npm startPOST /api/submit-review
Submit a question attempt with performance data.
GET /api/reviews/today/:userId
Get all questions scheduled for review today.
The SM-2 (SuperMemo-2) algorithm optimizes review intervals based on performance:
- Quality Score: Calculated from difficulty, time taken, and whether you passed
- Easiness Factor: Adjusts based on performance (2.5 default)
- Interval: Time until next review (increases with successful reviews)
- Repetitions: Number of successful reviews in a row
├── src/
│ ├── init_db.sql # Database schema
│ ├── index.js # Main application server
│ ├── spacedRepAlgo.js # SM-2 algorithm implementation
│ ├── dailyCronJob.js # Daily review scheduler
│ └── package.json # Dependencies
├── leetcode-tracker.db # SQLite database
└── README.md # This file
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - feel free to use this for your own interview preparation!