#!/bin/bash # LeetCode Teacher - Interactive Playground Generator # Creates browser-based coding environments with real product challenges set -e GREEN='\033[0;32m' BLUE='\033[0;34m' PURPLE='\033[0;35m' NC='\033[0m' print_success() { echo -e "${GREEN}✓ $1${NC}"; } print_info() { echo -e "${BLUE}ℹ $1${NC}"; } prompt_select() { local prompt="$1" local var_name="$2" shift 2 local options=("$@") echo -e "${BLUE}${prompt}${NC}" PS3="Select (1-${#options[@]}): " select opt in "${options[@]}"; do if [ -n "$opt" ]; then eval "$var_name='$opt'" break fi done } echo "" echo "╔════════════════════════════════════════════════════════════╗" echo "║ LeetCode Teacher - Playground Generator 🚀 ║" echo "╚════════════════════════════════════════════════════════════╝" echo "" print_info "Step 1/5: Choose Pattern" prompt_select "Which pattern to practice?" PATTERN \ "Two Pointers" \ "Sliding Window" \ "Fast & Slow Pointers" \ "BFS/DFS" \ "Binary Search" \ "Top K Elements" \ "Dynamic Programming" \ "Backtracking" print_info "Step 2/5: Difficulty Level" prompt_select "Choose difficulty:" DIFFICULTY \ "Easy" \ "Medium" \ "Hard" print_info "Step 3/5: Programming Language" prompt_select "Which language?" LANGUAGE \ "Python" \ "TypeScript" \ "Kotlin" \ "Swift" print_info "Step 4/5: Real Product Context" prompt_select "Which product scenario?" PRODUCT \ "Instagram (Social Media)" \ "Uber (Ride Sharing)" \ "Netflix (Streaming)" \ "Amazon (E-commerce)" \ "Twitter (Social Network)" \ "LinkedIn (Professional Network)" print_info "Step 5/5: Output" read -p "Playground name (e.g., two-sum-playground.html): " OUTPUT_FILE OUTPUT_DIR="./leetcode-playgrounds" mkdir -p "$OUTPUT_DIR" OUTPUT_PATH="$OUTPUT_DIR/$OUTPUT_FILE" print_info "🚀 Generating your interactive coding playground..." # Generate HTML playground cat > "$OUTPUT_PATH" << 'EOF' 🚀 LeetCode Teacher - PROBLEM_TITLE

🚀 LeetCode Teacher

Master coding patterns through real product challenges

PROBLEM_TITLE

DIFFICULTY_LEVEL PATTERN_NAME LANGUAGE_NAME

📱 Real Product Scenario

PROBLEM_DESCRIPTION

Problem:

PROBLEM_STATEMENT

Example:

EXAMPLE_INPUT_OUTPUT

Constraints:

    CONSTRAINTS_LIST
0
Attempts
0
Tests Passed
0
Hints Used
0s
Time Spent

💻 Code Editor

Click "Run Tests" to test your solution...
EOF echo "" print_success "Playground created: $OUTPUT_PATH" echo "" print_info "🚀 To use:" echo " open $OUTPUT_PATH" echo "" print_info "Features:" echo " ✓ Syntax-highlighted code editor" echo " ✓ Real-time test execution" echo " ✓ Progressive hints" echo " ✓ Solution viewer" echo " ✓ Progress tracking" echo " ✓ $LANGUAGE implementation" echo "" print_info "💡 Tips:" echo " - Start with the brute force approach" echo " - Use hints if you're stuck for > 15 min" echo " - Always analyze time/space complexity" echo " - Practice the same pattern 3-5 times" echo ""