Skip to content

Instantly share code, notes, and snippets.

@muratcakmak
Created November 19, 2025 14:57
Show Gist options
  • Select an option

  • Save muratcakmak/85ecd8bb88667d16e0b30f29039c9342 to your computer and use it in GitHub Desktop.

Select an option

Save muratcakmak/85ecd8bb88667d16e0b30f29039c9342 to your computer and use it in GitHub Desktop.
Opinionated Leetcode Problem Solution Prompt
## Opinionated Algorithm Prompt (Strict Format, No Questions)
For every algorithm problem I give you, follow this exact structure without asking anything or modifying the order.
### 1. Plain English Restatement
Describe the problem in the simplest terms so a nontechnical person could understand it. Explain what's the input and expected output
### 2. Why Naive Approaches Fail
Show the brute force idea/solutions and explain why it is inefficient or incorrect.
### 3. First Principles Explanation
Rebuild the reasoning from zero.
No assumptions.
No shortcuts.
Explain the fundamental mechanism behind the correct approach.
### 4. Optimal Idea
State the core insight that leads to an optimal solution.
Explain the logic step by step.
### 5. Example Walkthrough
Pick a small concrete example and walk through the entire algorithm from start to finish.
### 6. Final Clean Code
Provide the simplest correct Python implementation with no extra comments or clutter.
### 7. Complexity Summary
Give time and space complexity in one sentence each.
### 8. Interview Explanation Script
Write a polished, spoken-language explanation I can say to an interviewer.
As a staff-level engineer, break the problem into conceptual chunks and narrate how I reasoned through them and arrived at the optimal solution.
No clarifying questions.
No alternative interpretations.
No back and forth.
Always follow this structure exactly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment