DEV Community

Cover image for top 10 tips for problem-solving
mahmoud
mahmoud

Posted on

top 10 tips for problem-solving

solving the problem

1- Understand the problem

  • Describe the problem for me on the paper so I can understand it

2- Explore concrete examples

  • Understand the inputs and the outputs expected to out
  • How to handle errors
  • What happens when the user enters something invalid

3- Break it down

  • break the problem into small parts and steps in the code place - - to solve the problem as steps to follow

4- solve the problem in a simple way

  • Write the solution to the problem as simply as possible

Refactoring the solution

5- Check the results

  • Make sure the output of your solution required one as output from your code

6- Refactor the code for a better version

  • Go through the solution steps and check if we can write it in a better way
  • Search if there is a helper function that can make the code run faster for time complexity

7- Reuse my code

  • think if I can use some parts of my code as solutions for other problem

8- work on time and space complexity

  • Work on making the code run faster than it exists
  • Work on making the code not consume much memory space

9- Search on google to find other solutions to learn from them

10- Share your solution

  • upload your solution on GitHub and share it with others
  • explain it so you will learn as much as you teach

Follow Me On LinkedIN

Oldest comments (3)

Collapse
 
sohrab09 profile image
Mohammad Sohrab Hossain

Good post.

Thanks for sharing.

Collapse
 
nicolus profile image
Nicolas Bailly

Depending on your workflow, step 2 would lead to step 2b : Write Unit Tests that reproduce the problem and fail.

I'm not even a big TDD proponent, but a hard to pinpoint bug is a perfect opportunity to add some tests, and ensure the same bug will not reappear later on.

Collapse
 
mahmoudsayed profile image
mahmoud

this is good opinion I'll try it for my next problems.
thanks for sharing looking forward to learn more from your experiences :)