AI Processing

LeetCode Ghost Window uses advanced AI technology to analyze captured LeetCode problems and generate comprehensive solutions with detailed explanations.

How AI Processing Works

The AI processing feature uses the following workflow:

1. Screenshot Capture

Capture screenshots of the LeetCode problem using the provided keyboard shortcuts.

2. Image Analysis

The screenshots are sent to OpenAI's Vision API, which extracts the problem statement, examples, constraints, and other relevant information.

3. Solution Generation

The AI generates a detailed solution to the problem, including code implementation, explanation of the approach, and complexity analysis.

4. Result Display

The solution is formatted with syntax highlighting and displayed in the application for your reference.

API Key Configuration

To use the AI processing feature, you need to configure your OpenAI API key:

  1. Obtain an API Key

    Sign up for an OpenAI account and obtain an API key from the OpenAI dashboard.

  2. Set the API Key

    There are two ways to set your API key:

    • In the application settings menu
    • Using the CLI command: leet-joseok config set apiKey YOUR_OPENAI_API_KEY

API Key Security

Your API key is stored securely on your local machine and is never shared with our servers. The key is used only for direct API calls from your computer to OpenAI.

Processing Shortcuts

Once you've captured screenshots, use these keyboard shortcuts to process them:

Ctrl+Shift+A

Process with 1 screenshot

Ctrl+Shift+B

Process with 2 screenshots

Ctrl+Shift+C

Process with 3 screenshots

Ctrl+Shift+L

Change solution language

Solution Output

The AI-generated solution includes:

  • Problem Understanding: A brief summary of the problem
  • Approach: Detailed explanation of the solution approach
  • Code Implementation: Complete code solution with syntax highlighting
  • Time Complexity: Analysis of the solution's time efficiency
  • Space Complexity: Analysis of the solution's memory usage
  • Alternative Approaches: When applicable, other ways to solve the problem

Language Selection

By default, the AI will try to detect the preferred programming language based on the problem context. You can also specify your preferred language:

Using the UI

Click the language selector in the toolbar to choose from supported languages like JavaScript, Python, Java, C++, and more.

Using the CLI

Set your default language through the CLI:

leet-joseok config set language python

API Usage and Limits

When using the AI processing feature:

  • Each processing request will consume tokens from your OpenAI API quota
  • The number of tokens used depends on the complexity and length of the problem
  • You can view your usage statistics in the OpenAI dashboard
  • The application uses the most cost-effective model that still provides high-quality solutions