#!/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'
Master coding patterns through real product challenges
PROBLEM_DESCRIPTION
PROBLEM_STATEMENT
EXAMPLE_INPUT_OUTPUT