Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Tracker App with Spaced Repetition

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.

Features

  • 📊 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

Database Schema

The application uses SQLite with two main tables:

user_pattern_progress

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

review_history

Stores complete history of all question attempts:

  • Question Info: question_name, question_pattern, difficulty
  • Performance: passed, time_in_minutes, quality_score
  • Metadata: submission_date

Application Flow

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

Setup Instructions

1. Install Dependencies

npm install

2. Create Database

# Create the SQLite database from schema
sqlite3 leetcode-tracker.db < src/init_db.sql

# Verify the database was created
sqlite3 leetcode-tracker.db ".tables"

3. Start the Application

npm start

API Endpoints

Submit Review

POST /api/submit-review

Submit a question attempt with performance data.

Get Today's Reviews

GET /api/reviews/today/:userId

Get all questions scheduled for review today.

SM-2 Algorithm

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

File Structure


├── 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

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

MIT License - feel free to use this for your own interview preparation!

About

A smart LeetCode practice tracker that uses the SM-2 spaced repetition algorithm to optimize your coding interview preparation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages