Skip to content

karote00/local-leetcode-trainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

84 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎯 Local LeetCode Trainer

A complete local coding practice environment with revolutionary AI teaching system - designed for deep learning and algorithmic mastery, not just solving problems.

This project is designed for practicing coding interview problems locally with AI assistance. It is not a LeetCode scraper and does not fetch problem content from LeetCode. Use the bundled local problem library to learn, experiment, and build confidence; when you're ready, open the official LeetCode page and challenge yourself there.

πŸ€– NEW: AI Teaching System - Your Personal Coding Tutor

Experience the future of coding education with intelligent, adaptive guidance that learns with you!

✨ What Makes This Special:

  • 🧠 Proactive AI Guidance - Get contextual hints without asking, based on your code patterns
  • 🎯 Adaptive Learning - AI adjusts difficulty and guidance based on your progress and attempts
  • πŸ’‘ Smart Code Analysis - AI understands your approach and suggests optimizations intelligently
  • πŸ”„ Progressive Hints - From gentle nudges to detailed explanations, escalating as needed
  • πŸŽ“ Concept Teaching - Learn algorithms and patterns, not just solutions
  • ⚑ Seamless Integration - AI teaching is built into every command, no special "AI mode"

πŸš€ AI-Enhanced Commands (No Prefixes Needed!)

# Intelligent hints that adapt to your skill level
lct hint two-sum 1              # AI analyzes your approach and provides contextual guidance
lct hint valid-parentheses 2    # Progressive hints that build on each other

# Deep learning analysis with AI insights
lct learn two-sum               # Comprehensive algorithm analysis and complexity insights
lct learn longest-palindromic-substring  # Multiple approach comparisons

# AI assistant for any coding question
lct ask "when should I use a hash map?"     # Get intelligent explanations
lct help-me "I don't understand stacks"    # Natural language AI assistance

🎯 AI Teaching in Action:

Traditional Hint System:

πŸ’‘ Hint: Try using a hash map for O(1) lookups

AI Teaching System:

πŸ€– **AI-Enhanced Hints for Two Sum**

🎯 **Problem Overview:**
This is one of the most fundamental problems in coding interviews!
Your goal is to find two numbers that add up to a target sum.

πŸ’‘ **Key Insights:**
- Think about the "complement" pattern
- What if you could remember numbers you've seen?

πŸ’‘ **Optimization Hint:**
I see you're using nested loops - that works but it's O(nΒ²)!

Try this approach:
1. Create a Map to store numbers you've seen
2. For each number, check if (target - number) exists
3. This reduces time complexity to O(n)!

πŸ’« **Next:** Try `lct hint two-sum 2` for implementation details

🧠 LEARN, Don't Just Solve

This tool is built for developers who want to truly understand algorithms, not just pass interviews.

πŸŽ“ What You'll Actually Learn:

πŸ” Problem Analysis Skills

  • What is the question really asking? - Break down complex problem statements into core requirements
  • How to catch the key insights - Identify the critical patterns and constraints that guide solution approach
  • Pattern recognition - Learn to spot common algorithmic patterns across different problems

🧩 Algorithm Selection Process

  • Why choose this specific algorithm? - Understand the reasoning behind algorithm selection
  • How to narrow down the solution space - Systematic approach to eliminate inefficient approaches
  • Trade-off analysis - Learn when to prioritize time vs space complexity

πŸ“Š Complexity Analysis

  • Big O intuition - Develop intuitive understanding of time and space complexity
  • Performance optimization - Learn how to identify and eliminate bottlenecks
  • Scalability thinking - Understand how solutions perform with real-world data sizes

🎯 Problem-Solving Methodology

  • Structured thinking process - Step-by-step approach to tackle any algorithmic problem
  • Edge case identification - Learn to systematically find and handle corner cases
  • Solution validation - Develop skills to verify correctness and completeness

πŸ’‘ Learning-First Features:

  • πŸ€– AI Collaboration - Use ChatGPT, Claude, Copilot to explore different approaches
  • πŸ” Deep Debugging - Add console.logs, breakpoints, step through your logic
  • πŸ“ Custom Test Cases - Create your own scenarios to test understanding
  • πŸ’­ Progressive Hints - Multi-level hint system that guides your thinking process
  • 🎯 Algorithmic Insights - Built-in explanations of why certain approaches work
  • πŸ“Š Complexity Analysis - Understand the performance implications of your solutions

πŸŽ“ AI-Powered Learning Methodology:

Step 1: Get AI-Guided Problem Introduction

lct challenge easy 1                # Get Two Sum problem
lct hint two-sum 1                  # AI provides problem overview and strategic guidance
# AI explains: What is this problem really asking?
# AI suggests: What approaches should you consider?

Step 2: Explore with AI Code Analysis

# Start coding your approach
lct hint two-sum 2                  # AI analyzes your code patterns
# AI detects: "I see you're using nested loops..."
# AI suggests: "Try using a hash map for O(1) lookups"

Step 3: Get Contextual Debugging Help

# When you encounter errors
lct test two-sum                    # Run tests
# AI automatically provides: "Looks like a null pointer issue..."
# AI explains: "This happens when you access undefined properties"

Step 4: Receive Progressive Guidance

lct hint two-sum 3                  # More specific implementation hints
# AI escalates help based on your attempts
# AI provides: Step-by-step implementation guidance

Step 5: Master the Concept

lct learn two-sum                   # Deep algorithmic analysis
# AI explains: Time/space complexity trade-offs
# AI connects: "This pattern appears in these other problems..."

Step 6: Ask Follow-up Questions

lct ask "why use hash maps instead of arrays?"
lct help-me "when should I use two pointers?"
# AI provides: Detailed explanations and comparisons
# AI suggests: Related concepts and problems to explore

✨ Why Practice Locally?

Use Your Development Environment for Deep Learning

Unlike the LeetCode website where you're limited to a basic web editor, the Local LeetCode Trainer gives you a complete learning environment where you can:

  • 🧠 Think deeply - No time pressure, explore multiple approaches
  • πŸ”¬ Experiment freely - Try different algorithms, compare performance
  • πŸ“š Build knowledge - Create your own notes and solution library
  • πŸ› οΈ Use your tools - VS Code, IntelliJ, or whatever helps you learn best
  • ⚑ Iterate quickly - No network delays, instant feedback on your ideas
  • 🎯 Focus on understanding - Built-in learning aids and algorithmic guidance

πŸ†š LeetCode Website vs Local Trainer

Feature LeetCode Website Local LeetCode Trainer
Development Environment 🌐 Web editor only πŸ› οΈ Your IDE + tools
AI Collaboration ❌ Limited βœ… Full access
Custom Test Cases ❌ No βœ… Yes
Debugging Tools ❌ Limited βœ… Full IDE support
Code Iteration Speed 🐌 Network delays ⚑ Instant
Progress Tracking βœ… Yes βœ… Yes + Local
Company Insights βœ… Yes βœ… Yes
Official Validation βœ… Yes ❌ No
Discussion Forums βœ… Yes ❌ No

πŸš€ Quick Start

Option 1: NPM Installation (Recommended)

# Install globally
npm install -g local-leetcode-trainer

# Start practicing immediately
local-leetcode-trainer challenge easy
# or use the short alias
lct challenge easy

Option 2: Clone Repository

# Clone and setup
git clone https://github.com/karote00/local-leetcode-trainer
cd local-leetcode-trainer
yarn install

# Use yarn commands
yarn challenge easy

Getting Started

# Choose your language (JavaScript is default)
local-leetcode-trainer lang python    # Switch to Python
lct lang java                         # Switch to Java
lct lang                              # Show current language

# Get your first challenge
lct challenge easy

# Start coding and testing
lct test easy/two-sum
lct open easy/two-sum           # Opens the official practice page for final submission

# Mark as completed when done
lct complete easy/two-sum

πŸ“š Database Scope: This trainer includes 200+ carefully selected problems covering all essential algorithmic patterns. While LeetCode has 3000+ problems, these 200+ represent the core knowledge needed for technical interviews and software engineering mastery. Quality over quantity! 🎯

🎯 Perfect Workflow

1. Local Development & Learning

yarn challenge medium           # Get a random problem
yarn test medium/problem-name   # Test your solution locally
# Ask AI: "Can you explain this algorithm approach?"
# Add console.logs, debug, iterate quickly

2. AI-Powered Learning

  • Explain algorithms: "How does this hash map approach work?"
  • Code review: "Can you optimize this solution?"
  • Debug help: "Why is my solution failing this test case?"
  • Pattern recognition: "What other problems use this technique?"

3. Final Validation

yarn open medium/problem-name   # Open the official practice page
# Copy your working solution and submit
yarn complete medium/problem-name  # Track your progress

πŸ“ Smart Organization

β”œβ”€β”€ easy/
β”‚   β”œβ”€β”€ two-sum/                # Active problems
β”‚   β”œβ”€β”€ palindrome-number/
β”‚   └── completed/              # Finished problems
β”‚       β”œβ”€β”€ valid-parentheses/
β”‚       └── merge-two-lists/
β”œβ”€β”€ medium/
β”‚   β”œβ”€β”€ add-two-numbers/
β”‚   └── completed/
β”œβ”€β”€ hard/
β”‚   └── completed/
└── scripts/                    # All the magic happens here

πŸ› οΈ AI-Enhanced Commands

πŸ€– AI Teaching & Learning (NEW!)

# Intelligent hints with contextual AI guidance
lct hint two-sum 1              # AI analyzes your approach, provides strategic guidance
lct hint valid-parentheses 2    # Progressive hints that build understanding
lct hint merge-k-sorted-lists 3 # Advanced guidance for complex problems

# Deep learning analysis with AI insights
lct learn two-sum               # Comprehensive algorithm analysis
lct learn longest-palindromic-substring  # Multiple approach comparisons
lct learn merge-k-sorted-lists  # Advanced algorithmic concepts

# AI assistant for any coding question
lct ask "when should I use a hash map?"     # Get intelligent explanations
lct help-me "I don't understand stacks"    # Natural language assistance
lct ask "how to optimize nested loops"     # Algorithm optimization guidance

🎯 Core Practice

lct challenge easy              # Get 1 easy problem with AI teaching available
lct challenge medium 2          # Get 2 medium problems
lct test two-sum               # Test your solution locally
lct open two-sum               # Open the official practice page for final submission

🌍 Language Management

lct lang                       # Show current language & stats
lct lang python               # Switch to Python (archives current work)
lct lang javascript           # Switch to JavaScript
lct lang java                 # Switch to Java
lct lang cpp                  # Switch to C++

πŸ“Š Progress Tracking

lct progress                   # Check completion progress with AI insights
lct complete two-sum           # Mark as completed
lct complete list              # See all completed problems
lct complete undo two-sum      # Move back to active

πŸ€– AI Teaching Features

  • Contextual Code Analysis: AI understands your approach and provides relevant hints
  • Progressive Learning: Hints escalate from gentle nudges to detailed explanations
  • Smart Error Interpretation: AI explains runtime errors and debugging strategies
  • Concept Teaching: Focus on understanding algorithms, not just solving problems
  • Adaptive Guidance: AI adjusts help based on your attempts and progress
  • Natural Language Assistant: Ask questions about any coding concept

⚑ Smart Features

  • Seamless AI Integration: AI teaching built into every command, no special modes
  • Graceful Fallback: Traditional hints when AI teaching scripts aren't available
  • Auto-detection: Commands work whether problem is active or completed
  • Progress tracking: See completion stats per difficulty with AI insights
  • Company insights: Know which companies ask each question
  • True variety: 125+ diverse problems with intelligent randomization

🎨 Features

🌍 Multi-Language Support

  • JavaScript - Default, Node.js execution
  • Python - Python 3 execution
  • Java - Compile and run with JDK
  • C++ - Compile with g++ and execute
  • Clean switching - Archives current work when changing languages
  • Language-specific templates - Proper syntax and structure for each language

🎯 Interview Practice Problem Format

  • Familiar coding-interview formatting - Problems are structured for local practice and AI coaching
  • Bundled problem descriptions - Curated local descriptions, examples, and constraints
  • Proper examples - Input/output/explanation format for fast local testing
  • Practical constraints - Constraints included where available in the bundled library
  • Follow-up questions - Includes follow-up challenges where applicable
  • Perfect function signatures - JSDoc for JavaScript, type hints for Python
  • Automatic definitions - ListNode definitions for linked list problems
  • Solution class format - Python uses LeetCode's Solution class structure

πŸ€– Revolutionary AI Teaching System (v1.11.0+)

  • Intelligent Tutoring Engine - YAML-based teaching scripts that adapt to your learning style
  • Contextual Code Analysis - AI understands your approach and provides relevant guidance
  • Progressive Hint System - From gentle nudges to detailed explanations based on attempts
  • Smart Error Interpretation - AI explains runtime errors and suggests debugging strategies
  • Concept-First Learning - Focus on understanding algorithms and patterns, not just solutions
  • Natural Language Assistant - Ask questions about any coding concept in plain English
  • Seamless Integration - AI teaching built into existing commands, no special "AI mode"
  • Graceful Fallback - Traditional hints when AI teaching scripts aren't available

πŸ“š Bundled Problems Database (v1.9.0+)

  • 125+ High-Quality Problems - Carefully curated database with complete problem data
  • AI Teaching Scripts - Growing collection of intelligent tutoring experiences
  • True Variety - Fixed critical bug - no more repeated "Two Sum" problems!
  • Perfect Distribution - Balanced across Easy, Medium, Hard difficulties and all major topics
  • Local-Only Problem Source - Generates challenges from the bundled library without web scraping
  • Rich Problem Data - Complete descriptions, examples, constraints, and company tags
  • Intelligent Selection - Advanced randomization with duplicate avoidance
  • Offline Reliability - Full functionality even without internet connection

πŸŽ“ Completed All Challenges? Congratulations!

πŸŽ‰ You've mastered 200+ carefully selected LeetCode problems - that's incredible!

If you've completed all available challenges in the Local LeetCode Trainer, you've achieved something remarkable. These 200+ problems represent the most important algorithmic patterns and concepts needed for technical interviews and software engineering excellence.

πŸš€ What's Next?

Option 1: Continue Learning Locally

  • Create Custom Challenges: You can manually add new problems using the same structure
  • Use Learning Tools: lct hint, lct learn, and AI integration still work perfectly
  • Review and Optimize: Revisit completed problems to improve your solutions

Option 2: Graduate to LeetCode

  • You're Ready: With 200+ problems mastered, you have solid algorithmic foundations
  • Premium Features: Explore LeetCode Premium for company-specific problem sets
  • Contest Practice: Participate in weekly contests to test your skills under time pressure
  • System Design: Move to system design problems for senior-level preparation

πŸ’‘ Adding Custom Problems

You can extend the database by creating new problem files:

# Create a new problem file
touch scripts/dynamic/problems/medium/your-problem-name.js

# Use the same structure as existing problems
# The system will automatically detect and include it

πŸ† You've Achieved Mastery

Completing 200+ algorithmic problems is a significant achievement that puts you in the top tier of software engineers. Whether you continue with more advanced topics or move to real-world applications, you've built a strong foundation for success.

Keep coding, keep learning, and congratulations on your journey! πŸš€

πŸ€– AI-Friendly Environment

  • Full IDE integration - Use your favorite editor with AI assistants
  • Debugging support - Add breakpoints, console.logs, step through code
  • Code iteration - Modify and test instantly without network delays
  • Learning conversations - Ask AI to explain concepts, algorithms, optimizations

🧠 Built-in Learning Assistant

  • Progressive hints - Get hints without spoiling the solution
  • Algorithm approaches - Learn multiple ways to solve each problem
  • Complexity analysis - Understand time and space trade-offs
  • Pattern recognition - See connections between similar problems
  • Related problems - Discover what to practice next

⚑ Lightning Fast

  • Instant testing - No network delays, immediate feedback
  • Zero dependencies - Tests run with plain Node.js, no Jest/Mocha required
  • Local execution - Everything runs on your machine
  • Quick iteration - Modify code and test in seconds

πŸ“Š Smart Progress Tracking

  • Completion tracking - Organized by difficulty level
  • Progress stats - See how many problems you've solved
  • Review capability - Test completed problems anytime
  • Smart organization - Clean separation of active vs completed

🏒 Interview Preparation

  • Company insights - See which companies ask each problem
  • Topic categorization - Practice specific algorithm types
  • Difficulty progression - Start easy, build up to hard problems
  • Comprehensive problem database - 200+ carefully curated problems covering all major patterns

πŸ“š Database Scope & Expectations

Important: This trainer contains 200+ high-quality problems, not all 3000+ LeetCode problems. This is intentional:

  • Quality over Quantity - Each problem is carefully selected for maximum learning value
  • Core Patterns Coverage - All essential algorithmic patterns and data structures included
  • Interview Readiness - Problems chosen based on frequency in technical interviews
  • Sufficient for Mastery - 200+ problems provide comprehensive preparation for most engineering roles

After completing all problems: You'll have mastered the fundamental algorithms needed for software engineering success. You can then graduate to LeetCode Premium for specialized practice or focus on system design and advanced topics.

πŸ€– For AI Assistants

This package provides COMPLETE local practice functionality - no additional implementation needed!

βœ… What This Package Already Does

  • Problem Generation: lct challenge easy - Creates complete problem files with templates
  • Multi-Language Support: JavaScript, Python, Java, C++ with proper templates
  • Testing Framework: lct test problem-name - Runs tests locally with zero dependencies
  • Progress Tracking: lct complete problem-name - Tracks completed problems
  • Learning Assistant: lct hint problem-name - Progressive hints and algorithm analysis
  • Browser Integration: lct open problem-name - Opens the official practice page for final submission

🎯 When Users Ask for Local Coding Practice Setup

DON'T create custom implementations. DO guide them to use existing commands:

# Instead of building custom problem generators:
lct challenge easy                    # Gets random easy problem
lct challenge medium 2               # Gets 2 medium problems

# Instead of building custom test runners:
lct test easy/two-sum               # Tests existing solution

# Instead of building progress tracking:
lct complete easy/two-sum           # Marks as completed
lct complete list                   # Shows all completed problems

⚠️ Common AI Mistakes to Avoid

  • DON'T build custom problem scrapers - lct challenge intentionally uses the bundled local library
  • DON'T create custom test frameworks - use lct test
  • DON'T build progress tracking systems - use lct complete
  • DON'T implement hint systems - use lct hint and lct learn
  • DON'T create language switching logic - use lct lang

πŸ’‘ How to Help Users Effectively

  1. First: Check if functionality exists with lct --help
  2. Then: Guide users to appropriate existing commands
  3. Only if needed: Extend existing functionality, don't replace it

πŸ“‹ Quick Command Reference for AI

lct challenge easy              # Generate problems
lct test [problem]             # Run tests
lct open [problem]             # Open in browser
lct complete [problem]         # Mark complete
lct lang [language]            # Switch language
lct hint [problem] [level]     # Get hints
lct learn [problem]            # Algorithm analysis
lct patterns                   # List patterns

🎯 Use Cases

πŸ›« Local Practice

  • Airplane flights, train rides, anywhere without internet
  • Coffee shops with unreliable WiFi
  • Focus sessions without online distractions
  • No automated scraping or background fetching from LeetCode

πŸ€– AI-Powered Learning

  • Collaborate with AI to understand algorithms
  • Get code reviews and optimization suggestions
  • Debug complex solutions with AI assistance
  • Learn patterns and techniques through conversation

πŸ”§ Development Environment

  • Use your preferred IDE and extensions
  • Full debugging capabilities
  • Custom test cases and edge case exploration
  • Integration with your development workflow

πŸ“ˆ Skill Building

  • Systematic practice with progress tracking
  • Focus on specific topics or difficulty levels
  • Build confidence before official submissions
  • Create a personal library of solved problems

🚦 Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • Yarn or npm
  • Your favorite code editor

Installation

git clone https://github.com/username/local-leetcode-trainer
cd local-leetcode-trainer
yarn install

Your First AI-Guided Problem

# Get a challenge with AI teaching
lct challenge easy

# Get AI-powered introduction and strategic guidance
lct hint two-sum 1

# Start coding with AI watching your approach
# The AI will provide contextual hints based on your code patterns

# Test your solution
lct test two-sum

# Get AI analysis of your solution
lct learn two-sum

# Ask the AI assistant any questions
lct ask "why is this O(n) instead of O(nΒ²)?"

# When ready, open the official practice page to submit
lct open two-sum

# Mark as completed with AI celebration
lct complete two-sum

🀝 Contributing

We'd love your help making this even better! Here are ways to contribute:

  • Add more problems - Expand the problem database
  • Improve test cases - Add better edge cases and examples
  • Enhance scripts - Make the tools even more powerful
  • Documentation - Help others get started
  • Bug reports - Found an issue? Let us know!

πŸ“ License

MIT License - feel free to use this for your own practice and share with others!

πŸ™ Acknowledgments

  • LeetCode for the amazing problem platform
  • The coding community for inspiration and feedback
  • AI assistants for making learning more interactive

Happy Coding! πŸŽ‰

Practice anywhere, learn with AI, submit with confidence.

About

A complete offline LeetCode practice environment with multi-language support - practice anywhere, collaborate with AI, submit with confidence

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors