Here's something that might surprise you:
You can't solve a problem you haven't defined.
Sounds obvious, right?
Yet every day, thousands of developers open their code editors and start typing solutions to problems they think they understand — without ever defining what the problem actually is.
The result? Bugs. Rework. Late nights. Frustration.
Let's fix that.
🧩 What Is a "Problem" in Computer Science?
In the real world, problems feel like emotions:
"My app is slow."
"Users are confused."
"This feature doesn't feel right."
But computers don't understand emotions.
A computer only understands well-defined problems with:
- Clear inputs
- Specific outputs
- Explicit constraints
When you skip defining these three things, you're not programming — you're guessing.
🔍 Real-World Problems vs Computational Problems
| Real-World Problem | Computational Problem |
|---|---|
| "The website loads too slowly" | "Given an array of 10,000 product images, return the first 10 that match user filters in <200ms" |
| "Users keep entering wrong data" | "Validate email format, check password strength, return error messages for invalid fields" |
| "The search is broken" | "Given a search query string and a dataset of 50k records, return all records containing the query (case-insensitive) sorted by relevance" |
The difference? Precision.
Every line of code you write is translating a fuzzy real-world need into a precise computational problem.
🎯 The Three Pillars of Problem Definition
Before writing a single line of code, answer these three questions:
1️⃣ What are the inputs?
- What data do you have?
- What format is it in?
- What's the range of possible values?
2️⃣ What are the outputs?
- What exactly needs to be produced?
- What format should it be in?
- What are the success criteria?
3️⃣ What are the constraints?
- Time limits? Memory limits?
- Edge cases? (empty inputs, invalid data, maximum values)
- Business rules? (cannot exceed X, must include Y)
🧠 The Trick That Changes Everything
Here's the trick most senior developers use without realizing it:
State the problem in one sentence using this format:
"Given [INPUTS], produce [OUTPUTS] subject to [CONSTRAINTS]"
Try it:
- ❌ "I need to sort this list"
✅ "Given an unsorted array of integers (size up to 10,000), produce a sorted array in ascending order, using O(n log n) time and O(1) extra space"
❌ "The login form isn't working"
✅ "Given an email and password from user input, validate against database records and return either a session token (if credentials match) or an error message (if invalid), within 500ms"
See the difference?
🔄 Three Perspectives on Every Problem
One of the most powerful mental models I've learned is looking at problems from multiple perspectives:
Perspective 1: The User's View
What does the user think they need?
"I want to find products faster"
Perspective 2: The Product's View
What does the system actually need to do?
"Filter 10,000 products by category, price range, and rating in under 200ms"
Perspective 3: The Implementer's View
How will you build it?
"Use a composite index on category+price, cache frequent queries, implement pagination"
Most developers stop at Perspective 1. Senior developers operate across all three.
⚠️ Why Jumping to Solutions Breaks Programs
Here's what happens when you skip problem definition:
- You solve the wrong problem — Built a feature nobody asked for
- You miss edge cases — Works perfectly until it crashes at 2 AM
- You can't explain your code — "I don't know why it works, but it works"
- You create technical debt — Quick fixes that become permanent headaches
The most expensive code is the code that solves the wrong problem.
🤖 Using AI The Right Way (A Lesson Most Developers Miss)
Here's something I've learned after watching hundreds of developers use AI tools:
AI is amazing at writing code. AI is terrible at defining problems.
Yet what do most developers do?
They copy-paste a vague requirement into ChatGPT and ask for code.
The result? Code that looks correct but solves the wrong problem.
The right way to use AI:
- Define your problem clearly (inputs, outputs, constraints)
- Ask AI to critique your problem definition
- Then ask for implementation options
The AI prompt I'm sharing below does exactly this — it tests your problem definition skills before you ever write code.
🧪 Test Your Problem Definition Skills
Here's an AI prompt that will evaluate whether you truly understand how to define problems:
You are an AI problem definition assessor.
I will give you a problem statement. Your task:
1. Ask me for the INPUTS, OUTPUTS, and CONSTRAINTS
2. If I miss any, challenge me
3. Once I've defined all three, evaluate if my definition is:
- Complete (nothing missing)
- Unambiguous (clear to any developer)
- Testable (can verify if solution works)
- Feasible (within given constraints)
Be strict. Do not let me get away with vague definitions.
Start by asking me for a problem I want to define.
Try it with a problem you're currently working on. The results might surprise you.
📥 Free Resources
I've documented the complete framework for understanding problems in computer science, including:
- Detailed explanations with examples
- Practice exercises
- The complete AI assessment prompt
- Syllabus mapping (Class 9 to B.Tech)
provided everything videio discription
🎥 Want the Full Video Walkthrough?
I created a detailed video lecture covering:
- Why some situations feel like problems and others don't
- Inputs, outputs, constraints — the real foundation of coding
- Three perspectives on every problem
- Common mistakes beginners make
💬 Your Turn
Think about the last bug you spent hours debugging.
Was it because you misunderstood the inputs?
Missed a constraint?
Solved the wrong problem entirely?
Drop your story in the comments — I'd love to learn from your experience.
Top comments (0)