# What is a Problem Solving Approach?[Explained in Detail]

What is a Problem Solving Approach?[Explained in Detail] |

Today we are going to talk about What is Problem Solving Approach?Why it is useful? Learn the steps in Problem Solving Approach. I was searching around for this topic on google but as it vast I got confused reading alot of posts. So I thought To write a post on this topic so you get what you are searching for at one place. To find a solution to a problem we need to define the problem first and then solve it.

Let’s get started,

What is an Algorithm?

A Process or set of steps to accomplish a certain task.

## Problem Solving Approach

1. Understand the Problem.

2. Explore Concrete Examples.

3. Break It Down.

4. Solve/Simplify.

5. Look Back and Refactor.

### #1] Understand the Problem.

- Can I restate the problem in my own words?
- What are the inputs that go into the problem?
- What are the outputs that should come from the solution to the problem?
- Can the outputs be determined from the inputs? In other words, do I have enough information to solve the problem?
- How should I label the important pieces of data that are part of the problem?

### #2] Explore Concrete Examples

- Start with simple examples
- Progress to complex examples
- Explore Examples with empty inputs
- Explore Examples with invalid inputs

### #3] Break it Down

Explicitly write down the steps you need to take.

This forces you to think about the code you’ll write before you write it, and helps you to catch any lingering conceptual issues or misunderstandings before you dive in and have to worry about the details

e.g(language details) as well.

### #4] Solve/Simplify

- Find the core difficulty in what you’re trying to do.
- Temporarily ignore that difficulty.
- Write simplified solution.
- Then incorporate that difficulty back in.

### #5] Look back & Refactor

- Can you check the result?
- Can you derive the result differently?
- Can you understand it at glance?
- Can you improve the performance?
- Can you think of other ways to refactor?

#### We got a look at how to solve a problem using a Approach? But there are some patterns we can use to solve the problems.

#### The following are some of them,

- Frequency Counter
- Multiple Pointers
- Sliding Window
- Divide and Conquer
- Dynamic Programming
- Greedy Algorithms
- Backtracking

In the next post we will take a deep dive in this Problem Solving Patterns with examples in Javascript.

Thank You for reading this post. Hope it helped you.If you like it please share and bookmark my site so that you don’t miss any post.