how to improve problem solving in programming

Blog / Time To Code / 6 Ways to Improve Your Programming Problem Solving

6 Ways to Improve Your Programming Problem Solving

6 Ways to Improve Your Programming Problem Solving

Sign up for 7pace newsletter.

I would like to sign up to receive email updates from 7pace. Protected by 7pace's privacy policy .

Reporting is here

Software development is, at its core, all about problem solving.

Think about it.

First, developers need to find a problem they can solve with software. Then, they have to figure out how humans solve that problem. And then, they have to find a way to effectively translate both the problem and the solution into code that a computer can use to solve the problem as well as (or better than) a person.

And then there are all the problems along the way: Working with teams, finding and fixing bugs, meeting delivery deadlines.

Engineers use problem solving skills constantly .

Because of that, if you want to become a better developer, one place to start might be becoming a better problem solver. But that’s easier said than done, and requires a deep understanding of what problem solving is, why it matters, and what it actually takes to improve those skills.

Ready to dive in? Let’s get started.

What Is Problem Solving, and Why Does It Matter?

Have you ever heard this famous Steve Jobs quote?

“Everyone in this country should learn to program a computer because it teaches you to think.”

“Everyone in this country should learn to program a computer because it teaches you to think.”

Jobs was right. Software development is as much about “soft skills” like critical thinking, communication, and problem solving as it is about “hard skills” like writing code.

And so, in the context of software development, problem solving can mean a few different things:

  • Creating an application that meets the end user’s goals.
  • Communicating effectively with team members to delegate work.
  • Finding and fixing bugs in the code.
  • Meeting a tight deadline for a client.

There’s only one thing that’s true no matter what problem solving looks like on a given day: It’s an integral part of every step of the software development process.

Why Should Engineers Work On Problem Solving Skills?

Just like any other skill, problem solving takes practice to apply and master.

Many developers think that becoming a better problem solver means being able to solve more problems, faster. But that’s not true — it means being able to find the best solution to a problem, and then put that solution in place.

Learning to do that is a great way to become a better developer overall. And while soft skills can be more difficult to learn and improve upon than hard skills, there are still some tips and tricks that can help you get better at problem solving specifically.

6 Ways to Get Better at Problem Solving

As you’ll see from these learning tools, getting better at problem solving is mostly like getting better at any other skill for work: You need to practice. A lot. And then practice some more.

6 Ways to Get Better at Problem Solving

Solve a Lot of Problems on a Lot of Different Platforms

Step one? Solve as many problems as you can, but try to focus on different types of problems on different platforms.

Here’s why this is so beneficial: It prevents you from getting comfortable with one problem solving method or framework. As we already know, in the world of software development, there is definitely no one-size-fits-all solution for the problems we encounter.

When you regularly practice solving different types of problems in different platforms, it reinforces the fact that you can’t always rely on the same technique to solve every problem. It forces you to learn to be flexible, and to choose the best tool or framework for each job.

Solve Problems in Contexts Other Than Work

Since problem solving is a skill that requires practice, you can (and should) work on it even outside of work hours.

This doesn’t need to be a chore — there are a lot of fun ways to practice problem solving, like by doing math or logic puzzles, solving crosswords, or playing a game like chess. Even many video games can help work on problem solving skills.

There are also many opportunities to practice problem solving just as you live your life from day to day. Broke something around the house? Use your problem solving skills to DIY a fix. Need to solve a conflict with a friend or a family member? You guessed it — time to practice problem solving.

Learn From Past Solutions, and Apply Them to New Problems

As you keep practicing problem solving as much as possible, you’ll start to see patterns emerge in the problems you solve. You’ll build up a sort of toolkit filled with the solutions you’ve found and used in the past, and you’ll be able to apply those to solving new problems.

This part is just as important as finding the solutions in the first place, because the more you practice your growing problem solving skills, the more natural it will become to apply the right solutions to different types of problems, making you able to solve new problems more and more quickly, while still using the best possible solves.

Ask Others for Help and Feedback

Sometimes, finding the best solution to a problem just requires a fresh, new set of eyes. That’s why it’s important to treat growing your problem solving skills not as a totally solo venture, but as a team endeavor where everyone at your organization can support each other and help each other get better.

If you’re stuck on a specific problem, ask for help. Someone else might have a method or framework you aren’t familiar with, that they can teach you. You can then apply that to more problems down the road.

And if you’ve come up with a solve for a problem, ask others for feedback. They might be able to help you refine or further improve your framework, making it even better.

Train the Problem Solving Part of Your Mind

How do you keep muscles from growing weaker over time? You keep exercising them.

The same goes for your brain, and especially for different knowledge-base skills, like problem solving. You’ll stay at the top of your brain if you keep “working out,” or practicing problem solving all the time.

A good move for a developer who wants to invest in their problem solving skills is scheduling time every week (or even every day) to consciously practice problem solving. Remember, this doesn’t necessarily mean solving work problems. You could commit to doing a tricky logic puzzle every day on your lunch break, for example. The important thing is to get in the practice, no matter how that looks.

Practice Other Skills Related to Problem Solving

Problem solving is an important skill on its own. But there are other necessary skills developers need to support their problem solving abilities, and those skills all take practice, too.

Flexibility. Critical thinking. Communication. Teamwork. Focusing on building and practicing all these skills will help you improve your problem solving.

Problem solving is one of the most necessary skills for developers to have. With time, practice, and dedication, they can improve it, constantly, and keep becoming better.

Tyler Hakes Profile Picture

Rethinking Timekeeping for Developers:

Turning a timesuck into time well spent.

Rethinking Timekeeping for Developers

Leave a Comment

By submitting this form I confirm that I have read the privacy policy and agree to the processing of my personal data for the above mentioned purposes.

how to improve problem solving in programming

Great article regarding problem solving skill, informative and motivating both.

Codility Tests

Outstanding post, I believe people should larn a lot from this website, its really user pleasant.

Technical Screening Tools

I was very happy to discover this great site. I need to thank you for your time just for this fantastic read!

Sharifa Ismail Yusuf

I learnt from this article that one of the key skills a developer need to have is the \"problem solving skills\". Developers also need dedication, time, create time to practice so they can improve their problem solving skills constantly. I do ask for help from others and learn from past solutions and apply them to new problems. From what I have learnt so far, I will try my best to start focusing on building and practicing Flexibility, critical thinking, communication and team work. Solve a lot of problems on a lot of different platforms. Solve problems on context other than work. To start carring out the above, I will schedule time in a week or everyday to conciously practice problem solving skills and other related problem solving skills.Thanks alot for this wonderful article!

dewayne sewell

Ive learnt the skill of problem solving is like a muscle, where it is important to keep exercising it to stay strong. It is important to be aware of the soft skills necessary for effective problem solving also, such as communication, critical thinking, team working that can leverage your technical hard skills to find a solution faster/more effective. Two things I will aim to do is; 1. To solve problems on different platforms so I don’t get too comfortable on only one and stagnate. This not only challenges the brain to see things from a new perspective, but to start the habit of continuous learning and skill building. 2. Reach out to others for help / discuss problems and my solutions for feedback and advice and sharing ideas.

Pakize Bozkurt

Problem solving skills is a crucial thing to make easier or better your life. In fact as a human being we do it in every day life. I mean, we have to do it for living. There are many ways to how to do it. The best way is we should ask right questions. First of all, we should ask some questions, such as; \' Are we aware of the problem?, Are we clarify the problem? Do we go into problem rational? Do we have reasons? or Do we have evidences? Do we do check them out? etc. I am from Philosophy teacher background. I like solving problem whatever in my work or daily life. Secondly, we should have more perspectives . Although our brain is lazy, it is always in a starvation for knowledge.For this there are many enjoyable things to do it. I highly recommend to read book every day which kind of you like it and playing game or solving puzzle. I love solving Sudoku, puzzle and reading book or article. Finally, solving problem is our invatiable needed. Having flexibility, critical thinking, communication and teamwork are easy way to improve us to how we can do our work better and good life. Massive thank for this amazing article!

I read this amazing article. Normally, everyone knows that but we dont use most of time this informations. Which one is the best way to use? Really it does not matter, every one is like a gold opinion. We can use this ideas for the daily life. I have already used that learn from past solution and ask to someone who knows very well. This is so helpful for me. Sometimes google is the best option for ask to someone. Google can be the best teacher for us as well. Soft skills like a team work or solving problem and critical thinking can be important than typing code. We can learn typing code but we can not learn critical thinking and solving problems from google very well. Thank you for this article.

Ipsa iure sed rerum

Excepturi quo volupt

Thanks for this !

Fahil kiima

Thanks a lot for the ideas on problem solving,I really had a problem with that and now going to use what you\'ve informed us about to better my problem solving skills. Thanks.

Alan Codinho

Nice overview

7pace is coming to GitHub! Sign up here for early access to test our beta!

Time tracking can actually be valuable for your team and your organization. But first, you and all your team members need a complete shift in the way you frame time tracking as part of your work.

Sign up for our newsletter and get your free ebook!

Your information is protected by 7pace's privacy policy .

Thanks for subscribing!

Click the download button to receive your free copy of Rethinking Timekeeping for Developers:Turning a Timesuck Into Time Well Spent

Click the download button to receive your free copy of

Contact sales

Please, note that your personal data provided via the above form will be processed in line with the  Privacy Policy . By clicking “Send”, you confirm that you have read the  Privacy Policy  that sets out the purposes for which we process personal data, as well as your rights related to our processing of your personal data.

I wish to receive marketing emails from Appfire.

Request sent

Your message has been transmitted to 7pace.

We will contact you as soon as possible.

Github

Sign up for GitHub News

Tutorial Playlist

Programming tutorial, your guide to the best backend languages for 2024, an ultimate guide that helps you to start learn coding 2024, what is backend development: the ultimate guide for beginners, all you need to know for choosing the first programming language to learn, here’s all you need to know about coding, decoding, and reasoning with examples, understanding what is xml: the best guide to xml and its concepts., an ultimate guide to learn the importance of low-code and no-code development, top frontend languages that you should know about, top 75+ frontend developer interview questions and answers, the ultimate guide to learn typescript generics, the most comprehensive guide for beginners to know ‘what is typescript’.

The Ultimate Guide on Introduction to Competitive Programming

Top 60+ TCS NQT Interview Questions and Answers for 2024

Most commonly asked logical reasoning questions in an aptitude test, everything you need to know about advanced typescript concepts, an absolute guide to build c hello world program, a one-stop solution guide to learn how to create a game in unity, what is nat significance of nat for translating ip addresses in the network model, data science vs software engineering: key differences, a real-time chat application typescript project using node.js as a server, what is raspberry pi here’s the best guide to get started, what is arduino here’s the best beginners guide to get started, arduino vs. raspberry pi: which is the better board, the perfect guide for all you need to learn about mean stack, software developer resume: a comprehensive guide, here’s everything all you need to know about the programming roadmap, an ultimate guide that helps you to develop and improve problem solving in programming, the top 10 awesome arduino projects of all time, roles of product managers, pyspark rdd: everything you need to know about pyspark rdd, wipro interview questions and answers that you should know before going for an interview, how to use typescript with nodejs: the ultimate guide, what is rust programming language why is it so popular, software terminologies, an ultimate guide that helps you to develop and improve problem solving in programming.

Lesson 27 of 34 By Hemant Deshpande

An Ultimate Guide That Helps You to Develop and Improve Problem Solving in Programming

Table of Contents

Coding and Programming skills hold a significant and critical role in implementing and developing various technologies and software. They add more value to the future and development. These programming and coding skills are essential for every person to improve problem solving skills. So, we brought you this article to help you learn and know the importance of these skills in the future. 

Want a Top Software Development Job? Start Here!

Want a Top Software Development Job? Start Here!

Topics covered in this problem solving in programming article are:

  • What is Problem Solving in Programming? 
  • Problem Solving skills in Programming
  • How does it impact your career ?
  • Steps involved in Problem Solving
  • Steps to improve Problem Solving in programming

What is Problem Solving in Programming?

Computers are used to solve various problems in day-to-day life. Problem Solving is an essential skill that helps to solve problems in programming. There are specific steps to be carried out to solve problems in computer programming, and the success depends on how correctly and precisely we define a problem. This involves designing, identifying and implementing problems using certain steps to develop a computer.

When we know what exactly problem solving in programming is, let us learn how it impacts your career growth.

How Does It Impact Your Career?

Many companies look for candidates with excellent problem solving skills. These skills help people manage the work and make candidates put more effort into the work, which results in finding solutions for complex problems in unexpected situations. These skills also help to identify quick solutions when they arise and are identified. 

People with great problem solving skills also possess more thinking and analytical skills, which makes them much more successful and confident in their career and able to work in any kind of environment. 

The above section gives you an idea of how problem solving in programming impacts your career and growth. Now, let's understand what problem solving skills mean.

Problem Solving Skills in Programming

Solving a question that is related to computers is more complicated than finding the solutions for other questions. It requires excellent knowledge and much thinking power. Problem solving in programming skills is much needed for a person and holds a major advantage. For every question, there are specific steps to be followed to get a perfect solution. By using those steps, it is possible to find a solution quickly.

The above section is covered with an explanation of problem solving in programming skills. Now let's learn some steps involved in problem solving.

Steps Involved in Problem Solving

Before being ready to solve a problem, there are some steps and procedures to be followed to find the solution. Let's have a look at them in this problem solving in programming article.

Basically, they are divided into four categories:

  • Analysing the problem
  • Developing the algorithm
  • Testing and debugging

Analysing the Problem

Every problem has a perfect solution; before we are ready to solve a problem, we must look over the question and understand it. When we know the question, it is easy to find the solution for it. If we are not ready with what we have to solve, then we end up with the question and cannot find the answer as expected. By analysing it, we can figure out the outputs and inputs to be carried out. Thus, when we analyse and are ready with the list, it is easy and helps us find the solution easily. 

Developing the Algorithm

It is required to decide a solution before writing a program. The procedure of representing the solution  in a natural language called an algorithm. We must design, develop and decide the final approach after a number of trials and errors, before actually writing the final code on an algorithm before we write the code. It captures and refines all the aspects of the desired solution.

Once we finalise the algorithm, we must convert the decided algorithm into a code or program using a dedicated programming language that is understandable by the computer to find a desired solution. In this stage, a wide variety of programming languages are used to convert the algorithm into code. 

Testing and Debugging

The designed and developed program undergoes several rigorous tests based on various real-time parameters and the program undergoes various levels of simulations. It must meet the user's requirements, which have to respond with the required time. It should generate all expected outputs to all the possible inputs. The program should also undergo bug fixing and all possible exception handling. If it fails to show the possible results, it should be checked for logical errors.

Industries follow some testing methods like system testing, component testing and acceptance testing while developing complex applications. The errors identified while testing are debugged or rectified and tested again until all errors are removed from the program.

The steps mentioned above are involved in problem solving in programming. Now let's see some more detailed information about the steps to improve problem solving in programming.

Steps to Improve Problem Solving in Programming

Right mindset.

The way to approach problems is the key to improving the skills. To find a solution, a positive mindset helps to solve problems quickly. If you think something is impossible, then it is hard to achieve. When you feel free and focus with a positive attitude, even complex problems will have a perfect solution.

Making Right Decisions

When we need to solve a problem, we must be clear with the solution. The perfect solution helps to get success in a shorter period. Making the right decisions in the right situation helps to find the perfect solution quickly and efficiently. These skills also help to get more command over the subject.

Keeping Ideas on Track

Ideas always help much in improving the skills; they also help to gain more knowledge and more command over things. In problem solving situations, these ideas help much and help to develop more skills. Give opportunities for the mind and keep on noting the ideas.

Learning from Feedbacks

A crucial part of learning is from the feedback. Mistakes help you to gain more knowledge and have much growth. When you have a solution for a problem, go for the feedback from the experienced or the professionals. It helps you get success within a shorter period and enables you to find other solutions easily.

Asking Questions

Questions are an incredible part of life. While searching for solutions, there are a lot of questions that arise in our minds. Once you know the question correctly, then you are able to find answers quickly. In coding or programming, we must have a clear idea about the problem. Then, you can find the perfect solution for it. Raising questions can help to understand the problem.

These are a few reasons and tips to improve problem solving in programming skills. Now let's see some major benefits in this article.

  • Problem solving in programming skills helps to gain more knowledge over coding and programming, which is a major benefit.
  • These problem solving skills also help to develop more skills in a person and build a promising career.
  • These skills also help to find the solutions for critical and complex problems in a perfect way.
  • Learning and developing problem solving in programming helps in building a good foundation.
  • Most of the companies are looking for people with good problem solving skills, and these play an important role when it comes to job opportunities 
Don't miss out on the opportunity to become a Certified Professional with Simplilearn's Post Graduate Program in Full Stack Web Development . Enroll Today!

Problem solving in programming skills is important in this modern world; these skills build a great career and hold a great advantage. This article on problem solving in programming provides you with an idea of how it plays a massive role in the present world. In this problem solving in programming article, the skills and the ways to improve more command on problem solving in programming are mentioned and explained in a proper way.

If you are looking to advance in your career. Simplilearn provides training and certification courses on various programming languages - Python , Java , Javascript , and many more. Check out our Post Graduate Program in Full Stack Web Development course that will help you excel in your career.

If you have any questions for us on the problem solving in programming article. Do let us know in the comments section below; we have our experts answer it right away.

Find our Full Stack Developer - MERN Stack Online Bootcamp in top cities:

About the author.

Hemant Deshpande

Hemant Deshpande, PMP has more than 17 years of experience working for various global MNC's. He has more than 10 years of experience in managing large transformation programs for Fortune 500 clients across verticals such as Banking, Finance, Insurance, Healthcare, Telecom and others. During his career he has worked across the geographies - North America, Europe, Middle East, and Asia Pacific. Hemant is an internationally Certified Executive Coach (CCA/ICF Approved) working with corporate leaders. He also provides Management Consulting and Training services. He is passionate about writing and regularly blogs and writes content for top websites. His motto in life - Making a positive difference.

Recommended Resources

Your One-Stop Solution to Understand Coin Change Problem

Your One-Stop Solution to Understand Coin Change Problem

Combating the Global Talent Shortage Through Skill Development Programs

Combating the Global Talent Shortage Through Skill Development Programs

What Is Problem Solving? Steps, Techniques, and Best Practices Explained

What Is Problem Solving? Steps, Techniques, and Best Practices Explained

One Stop Solution to All the Dynamic Programming Problems

One Stop Solution to All the Dynamic Programming Problems

The Ultimate Guide on Introduction to Competitive Programming

The Ultimate Guide to Top Front End and Back End Programming Languages for 2021

  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.

How to Solve Coding Problems with a Simple Four Step Method

Madison Kanna

I had fifteen minutes left, and I knew I was going to fail.

I had spent two months studying for my first technical interview.

I thought I was prepared, but as the interview came to a close, it hit me: I had no idea how to solve coding problems.

Of all the tutorials I had taken when I was learning to code, not one of them had included an approach to solving coding problems.

I had to find a method for problem-solving—my career as a developer depended on it.

I immediately began researching methods. And I found one. In fact, what I uncovered was an invaluable strategy. It was a time-tested four-step method that was somehow under the radar in the developer ecosystem.

In this article, I’ll go over this four-step problem-solving method that you can use to start confidently solving coding problems.

Solving coding problems is not only part of the developer job interview process—it’s what a developer does all day. After all, writing code is problem-solving.

A method for solving problems

This method is from the book How to Solve It by George Pólya. It originally came out in 1945 and has sold over one million copies.

His problem-solving method has been used and taught by many programmers, from computer science professors (see Udacity’s Intro to CS course taught by professor David Evans) to modern web development teachers like Colt Steele.

Let’s walk through solving a simple coding problem using the four-step problem-solving method. This allows us to see the method in action as we learn it. We'll use JavaScript as our language of choice. Here’s the problem:

Create a function that adds together two numbers and returns that value. There are four steps to the problem-solving method:

  • Understand the problem.
  • Devise a plan.
  • Carry out the plan.

Let’s get started with step one.

Step 1: Understand the problem.

When given a coding problem in an interview, it’s tempting to rush into coding. This is hard to avoid, especially if you have a time limit.

However, try to resist this urge. Make sure you actually understand the problem before you get started with solving it.

Read through the problem. If you’re in an interview, you could read through the problem out loud if that helps you slow down.

As you read through the problem, clarify any part of it you do not understand. If you’re in an interview, you can do this by asking your interviewer questions about the problem description. If you’re on your own, think through and/or Google parts of the question you might not understand.

This first step is vital as we often don’t take the time to fully understand the problem. When you don’t fully understand the problem, you’ll have a much harder time solving it.

To help you better understand the problem, ask yourself:

What are the inputs?

What kinds of inputs will go into this problem? In this example, the inputs are the arguments that our function will take.

Just from reading the problem description so far, we know that the inputs will be numbers. But to be more specific about what the inputs will be, we can ask:

Will the inputs always be just two numbers? What should happen if our function receives as input three numbers?

Here we could ask the interviewer for clarification, or look at the problem description further.

The coding problem might have a note saying, “You should only ever expect two inputs into the function.” If so, you know how to proceed. You can get more specific, as you’ll likely realize that you need to ask more questions on what kinds of inputs you might be receiving.

Will the inputs always be numbers? What should our function do if we receive the inputs “a” and “b”? Clarify whether or not our function will always take in numbers.

Optionally, you could write down possible inputs in a code comment to get a sense of what they’ll look like:

//inputs: 2, 4

What are the outputs?

What will this function return? In this case, the output will be one number that is the result of the two number inputs. Make sure you understand what your outputs will be.

Create some examples.

Once you have a grasp of the problem and know the possible inputs and outputs, you can start working on some concrete examples.

Examples can also be used as sanity checks to test your eventual problem. Most code challenge editors that you’ll work in (whether it’s in an interview or just using a site like Codewars or HackerRank) have examples or test cases already written for you. Even so, writing out your own examples can help you cement your understanding of the problem.

Start with a simple example or two of possible inputs and outputs. Let's return to our addition function.

Let’s call our function “add.”

What’s an example input? Example input might be:

// add(2, 3)

What is the output to this? To write the example output, we can write:

// add(2, 3) ---> 5

This indicates that our function will take in an input of 2 and 3 and return 5 as its output.

Create complex examples.

By walking through more complex examples, you can take the time to look for edge cases you might need to account for.

For example, what should we do if our inputs are strings instead of numbers? What if we have as input two strings, for example, add('a', 'b')?

Your interviewer might possibly tell you to return an error message if there are any inputs that are not numbers. If so, you can add a code comment to handle this case if it helps you remember you need to do this.

Your interviewer might also tell you to assume that your inputs will always be numbers, in which case you don’t need to write any extra code to handle this particular input edge case.

If you don’t have an interviewer and you’re just solving this problem, the problem might say what happens when you enter invalid inputs.

For example, some problems will say, “If there are zero inputs, return undefined.” For cases like this, you can optionally write a comment.

// check if there are no inputs.

// If no inputs, return undefined.

For our purposes, we’ll assume that our inputs will always be numbers. But generally, it’s good to think about edge cases.

Computer science professor Evans says to write what developers call defensive code. Think about what could go wrong and how your code could defend against possible errors.  

Before we move on to step 2, let’s summarize step 1, understand the problem:

-Read through the problem.

-What are the inputs?

-What are the outputs?

Create simple examples, then create more complex ones.

2. Devise a plan for solving the problem.

Next, devise a plan for how you’ll solve the problem. As you devise a plan, write it out in pseudocode.

Pseudocode is a plain language description of the steps in an algorithm. In other words, your pseudocode is your step-by-step plan for how to solve the problem.

Write out the steps you need to take to solve the problem. For a more complicated problem, you’d have more steps. For this problem, you could write:

// Create a sum variable.

Add the first input to the second input using the addition operator .

// Store value of both inputs into sum variable.

// Return as output the sum variable. Now you have your step-by-step plan to solve the problem. For more complex problems, professor Evans notes, “Consider systematically how a human solves the problem.” That is, forget about how your code might solve the problem for a moment, and think about how you would solve it as a human. This can help you see the steps more clearly.

3. Carry out the plan (Solve the problem!)

Hand, Rubik, Cube, Puzzle, Game, Rubik Cube

The next step in the problem-solving strategy is to solve the problem. Using your pseudocode as your guide, write out your actual code.

Professor Evans suggests focusing on a simple, mechanical solution. The easier and simpler your solution is, the more likely you can program it correctly.

Taking our pseudocode, we could now write this:

Professor Evans adds, remember not to prematurely optimize. That is, you might be tempted to start saying, “Wait, I’m doing this and it’s going to be inefficient code!”

First, just get out your simple, mechanical solution.

What if you can’t solve the entire problem? What if there's a part of it you still don't know how to solve?

Colt Steele gives great advice here: If you can’t solve part of the problem, ignore that hard part that’s tripping you up. Instead, focus on everything else that you can start writing.

Temporarily ignore that difficult part of the problem you don’t quite understand and write out the other parts. Once this is done, come back to the harder part.

This allows you to get at least some of the problem finished. And often, you’ll realize how to tackle that harder part of the problem once you come back to it.

Step 4: Look back over what you've done.

Once your solution is working, take the time to reflect on it and figure out how to make improvements. This might be the time you refactor your solution into a more efficient one.

As you look at your work, here are some questions Colt Steele suggests you ask yourself to figure out how you can improve your solution:

  • Can you derive the result differently? What other approaches are there that are viable?
  • Can you understand it at a glance? Does it make sense?
  • Can you use the result or method for some other problem?
  • Can you improve the performance of your solution?
  • Can you think of other ways to refactor?
  • How have other people solved this problem?

One way we might refactor our problem to make our code more concise: removing our variable and using an implicit return:

With step 4, your problem might never feel finished. Even great developers still write code that they later look at and want to change. These are guiding questions that can help you.

If you still have time in an interview, you can go through this step and make your solution better. If you are coding on your own, take the time to go over these steps.

When I’m practicing coding on my own, I almost always look at the solutions out there that are more elegant or effective than what I’ve come up with.

Wrapping Up

In this post, we’ve gone over the four-step problem-solving strategy for solving coding problems.

Let's review them here:

  • Step 1: understand the problem.
  • Step 2: create a step-by-step plan for how you’ll solve it .
  • Step 3: carry out the plan and write the actual code.
  • Step 4: look back and possibly refactor your solution if it could be better.

Practicing this problem-solving method has immensely helped me in my technical interviews and in my job as a developer. If you don't feel confident when it comes to solving coding problems, just remember that problem-solving is a skill that anyone can get better at with time and practice.

If you enjoyed this post, join my coding club , where we tackle coding challenges together every Sunday and support each other as we learn new technologies.

If you have feedback or questions on this post, feel free to tweet me @madisonkanna ..

Read more posts .

If you read this far, thank the author to show them you care. Say Thanks

Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started

Arc Developer Career Blog

Problem-Solving Skills for Software Developers: Why & How to Improve

how to improve problem-solving skills for software developers

Problem-solving skills go hand-in-hand with software development. Learn some great problem-solving techniques and tips for improvement here!

Software developer jobs today require that you possess excellent problem-solving skills , and for good reason. Unfortunately, there seems to be a sort of talent gap when it comes to this one skill required of all software developers.

Troubleshooting and problem resolution are both informally and formally taught, but you mostly find that software developers have to learn problem-solving skills on their own. This is true for self-taught developers , obviously, but also even for those with software engineering degrees or who’ve graduated from coding boot camps.

This is why it’s necessary to acquaint yourself with the problem-solving process, whether you are a newbie or an experienced developer. In this article, we’ll explore everything you need to know about problem-solving so you can 10x your software development career.

Arc Signup Call-to-Action Banner v.6

What are Problem-Solving Skills?

As a developer, what do we mean by problem-solving? Let’s attempt a simple definition.

In software development, problem-solving is the process of using theories and research to find solutions to a problem domain, while testing different ideas and applying best practices to achieve a desired result. Problem-solving also has to do with utilizing creativity and logical thought processes to identify problems and resolve them with software.

Becoming a great software developer hinges more on learning algorithms than programming languages or frameworks . And algorithms are simply step-by-step instructions to solve a given problem.

Read More : How to Build a Software Engineer Portfolio (With Examples & Tips)

Why are impeccable problem-solving skills crucial?

Making good use of a computer language can be likened to being a skilled writer. An effective writer must know how to construct sentences and use grammar appropriately. There’s more to writing than just knowing all the words in the dictionary, and that’s how it works for developers, too.

You have different tasks to work on as a software developer, including perhaps designing, coding, and troubleshooting. Much of your time will be spent on identifying problems, spotting and correcting bugs, and making sense of codebases from before you started working there. Being ingenious at problem-solving is essential in creating incredible solutions to issues that arise throughout software development.

To demonstrate ingenuity, let’s consider Google’s autocomplete tool as an example.

The autocomplete tool is built to suggest related terms in the search bar as you type. The idea behind the tool is to reduce more than 200 years of time spent typing daily and to help users save time by up to 25% while typing.

Here’s what had to be done:

  • To activate real-time completion of suggestions, the UI experience and JavaScript had to be implemented.
  • Next, since users could type just about anything, the autocomplete suggestions had to be compiled into a sensible list dependent on user input.
  • Then, Google had to create a back-end sustainability system for this function. Doing this meant massively increasing its infrastructure to accommodate all forms of data query and HTTP requests.
  • Finally, the user interface had to be refined by software engineers in order to make sure that every user enjoyed a worthwhile experience. So they employed Google Trends to power the auto-completion tool while using algorithms to take out explicit or offensive predictions in line with Google’s auto-completion policy.

This is just one of Google’s innumerable problem-solving examples, but it’s clear to see that solving problems involves more than just telling a computer to do stuff. It’s about your ability to come up with parameters rightly tailored to target users so they can meet their goals.

So why must developers focus on problem-solving at work?

Software developers work with a wide range of people and departments, and it’s common to discover that some clients and teams find it difficult to define what they want. As a problem solver, it’s up to you to help them identify their needs and communicate their thoughts in an effective way.

Of course, you’ll need time and practice to develop your problem resolution ability. That’s because it’s less about solving problems faster but more about coming up with the best solution . And then you’ll need to deploy that solution.

Read More : Common Interview Questions for Software Developer Jobs (Non-Technical)

Types of problem-solving skills

Now let’s talk about four types of problem-solving skills for developers:

1.  Parallel thinking

As a software developer, parallel thinking is a crucial skill necessary to perform optimally. This makes it possible for you to carry out two tasks that complement each other at the same time (like an optimized form of multitasking skills). Being able to reorder tasks to boost parallel execution can help to improve your output and save valuable time .

2. Dissecting broad and/or complex goals

When it comes to building software, you will need to effectively outline the steps and tasks necessary to achieve your goal. Developers must learn to break large and complex tasks into smaller assignments because this is an important skill that will help you create results with precision.

3. Reimplementing existing solutions

You don’t always need to reinvent the wheel. Part of being an effective software developer comes with being able to use already existing tools before even thinking of creating new solutions. Developing problem-solving skills is very much connected to finding solutions that already exist and reusing them.

4. Abstraction

Keep in mind that goals tend to evolve. So if your client comes up with new ideas, that will mean changing your design goals and reordering your tasks. A good programmer must learn to create solutions in such a way that does not require a complete redesign from scratch.

You also have to become adept at abstracting problems so that your solutions can get them resolved so long as they aren’t entirely different from the original issue. You don’t necessarily have to abstract every aspect to avoid more complications being created. This calls for balance by abstracting only where necessary without making narrow decisions.

Read More : Learn 8 Great Benefits of Working From Home

4 Important Tips & Strategies for Improving Problem-Solving Skills

To keep your problem-solving skills and techniques from growing weaker over time, you need to exercise them non-stop. As they say: practice makes perfect!

To train the problem-solving side of your brain, these four tips and strategies can help you improve your abilities:

1. Make problem-solving a part of your life

Never restrict yourself to working on problems only during work hours. Don’t make it a chore, but, instead, do things that make problem-solving look fun. The game of chess, solving puzzles, and playing video games that compel you to think critically will help strengthen your problem-solving skills, and you can tell your significant other you are advancing your career! 🙂

When you come to a complex problem in your life, whether it’s budgeting for a home or renovating the downstairs bathroom, approach it both creatively and critically. Ask yourself: What would a great software engineer do in this situation?

2. Use different platforms to solve problems

Proffer solutions to a set of problems without restricting yourself to one platform. Using different platforms and tools regularly helps make sure you become flexible as a problem-solver. And it makes sense, because there really is no universal solution for the different problems that pop up in your line of work. Trying out different platforms to solve different problems helps you to keep an open mind and enables you to test out different techniques when looking to find solutions.

Read More : 12 Common Mistakes Keeping You From Landing Your First Developer Job

Arc Signup Call-to-Action Banner v.4

3. Be open to assistance from external sources

Part of being a good software developer comes with being able to ask for help and also accept all forms of feedback. You might need a different opinion or a new set of eyes to help find the most fitting solution to some problems. It makes sense to view building problem-solving skills as more of a team effort rather than a personal journey.

Have an open mind and heart to function not only as an individual but also as a collective. It’s a utopian working environment where everyone supports each other to become better versions of themselves. So if you come across an issue that keeps you stuck, get help! You may find someone who has a more refined framework or method you never knew existed or would have thought of using. You could then learn from them and add their solution to your toolkit.

Get feedback often, as well. This could be the catalyst to making improvements to your processes and evolving them into something truly refined.

4. Tackle new problems using lessons from past solutions

As you practice and finesse your ability to identify problems and find solutions, you’ll begin to notice patterns. It’s more like developing your toolbox armed with a wide range of solutions that have proved useful in the past. So when problems emerge, you will notice how easy it is to take some of those old solutions and apply them to the new problem.

The more you attempt to apply creativity in solving problems, the more you grow your skills. In the long run, that will help you find the right solutions faster and apply them to a wide range of problems more naturally. It’s all about improving the effectiveness and efficiency with which you tackle new problems while applying only the best possible solutions.

Read More : How to Stay Motivated at Work

3 Complementary Skills to Improve to Become a Good Problem Solver

Developing software is mostly about problem-solving at the very core before even writing your first lines of code. You have to identify problems that can be solved using software. Then you have to go on to understand how people try to solve such problems in real life.

It’s up to you to come up with a framework that allows you to take both the problem and the solution and convert them into computer code. And you have to do this in such a way that makes the software even more efficient and effective than a human.

While going through this process, developers also have to handle other problems such as deadline deliveries, checking for bugs and fixing them, and collaborate across teams. So, supporting skills must not be overlooked.

Software developers must build interpersonal skills and collaboration skills . Being able to empathize, accept feedback, handle criticism, listen intently, and show respect for others are all important characteristics and abilities necessary for teamwork, and, thus, necessary for solving problems on the job.

Read More : 5 Ways to Stand Out & Get Noticed in Your Current Development Job

Communication

No one is an island, and that’s true when you consider how software engineers work. Building software requires keeping up with clients and teammates and other departments. You can’t afford to be a Lone Ranger, at least not 100% of the time, and that’s why employers always look for good communication skills.

Being a good software developer also involves how well you can break down very complex concepts to laypeople. You want to be the kind of person who fixes a problem and is able to explain how you were able to do it. It’s all about your ability to be clear and articulate about every aspect of your work. And you want to be able to communicate not just verbally but also in written form.

To build your communication skills as a developer, you can learn from more experienced people and observe how they interact with their clients. And, don’t forget, with more and more companies becoming global enterprises and going remote, it’s important to brush up on your intercultural communication skills , as well.

Logical thinking

The difference between elite software developers and average ones is often said to be logical thinking. The ability to process thoughts logically is important, because you’ll often spend most of your time finding and fixing bugs rather than writing code.

Problems can show up from just about anywhere, even from what seems to be the most insignificant errors. So, your ability to detect software issues and solve these problems using deductive thought processes is a vital ingredient to your success as a software developer.

Read More : Questions to Ask at Interviews for Software Engineering Jobs

Problem-Solving Stages & Practices

There are countless problem-solving processes and various schools of thought regarding the best way to approach problems whenever they arise. To solve that problem, we’ve pooled some of these frameworks together to come up with a comprehensive approach to problem-solving.

Step 1 – Define the problem

You have to first start with problem identification. Knowing what you are dealing with is important, because you don’t want to risk spending valuable time applying wrong solutions. Avoid making automatic assumptions. Even when the symptoms look familiar, you want to investigate properly because such signs could be pointing to something else entirely.

Problems in software development come in different sizes and scopes. You could be having trouble getting some aspects of the product to respond in the desired way. Or maybe you’re having issues trying to decipher a codebase section where you can no longer communicate with the original developers. Sometimes, the problem could come in the form of an unfamiliar error message and you’re at loss.

Once you’re able to define the problem, make sure to document it.

Step 2 – Analyze the problem

Now it’s time to carry out problem analysis . Before deciding what problem resolution methods to adopt, it’s necessary to find out all there is to the issue, which builds on our first step. This will make it easier to come up with ideas and solutions later on.

Problem analysis isn’t always a walk in the park. There are times when the problem involves a very small mistake such as failing to import a package correctly or a small syntax error. Other times, however, it could be such a huge error, like the entire program acting differently than what you want. There might be no alarms or blinking red lights to tell you what the exact problem is.

If you encounter such situations, you can find answers by articulating the problem. Document what you intend to do, what you’ve done, the original intention for the program, and where you currently are. Communication comes in handy here, of course, not just in your documentation, but also in how you relay it to your teammates.

Read More : Got a Busy Developer Schedule? Here’s How to Keep Learning & Make Time

Step 3 – Brainstorm

This step has to do with generating ideas, and you can benefit from discussing the problem with a team and then coming up with ways to get it fixed. Keep in mind that problem-solving at work involves interacting with a diverse group of people where the individuals have unique skill sets and experiences.

Many developers tend to neglect the previous steps and rush straight into brainstorming. That’s definitely not a good way to go about problem-solving. The idea is not to skip the important steps in the process.

Once you get to the point where ideas need to be generated, do not discard any, because this step relies on a wide range of ideas. Only after gathering as many perspectives as possible should you then begin reviewing and narrowing down to the best possible solution.

Step 4 – Make a decision

At this point, all viable solutions have to be analyzed before selecting the most appropriate one to implement. Picking the best possible solution depends on its ability to meet certain criteria. It must be suitable, feasible, and then acceptable.

What it means is that the solution must be able to get the problem solved. It should also be easy to see how such a solution fits into the equation. And then every member of the team involved in the brainstorming process has to unanimously accept the solution.

Read More : How to Network as a Software Engineer

Step 5 – Implement

After identifying and choosing the solution, the next logical step is to plan out the implementation process and then execute it. Coming up with a detailed plan is crucial if the solution is to be a success.

Now this plan must detail all the necessary steps required to implement the solution. It will also explain the length of time and stages of work required. Once all of that is put in place, you can then move forward with the execution. The idea is not just to execute a solution but to do it the right way.

Implementation using automated tests can help to keep unexpected issues from arising in the future. Some other problem-solving practices or approaches begin the process with this step. So, whenever any changes are made to the project, tests asserting that the changes will perform as required will be written first before the changes are then made.

Step 6 – Evaluate

No problem-solving process can be deemed comprehensive enough if there is no room for evaluation. Whatever the solution may be, it has to undergo strict evaluation in order to see how it performs. That will also help determine whether the problem still exists and the extent to which such an issue keeps recurring.

In the event that the problem persists despite the implementation of a detailed plan, then the developer and team may even have to restart the problem-solving process. However discouraging that may sound, at least you’ll have caught it early enough. And, this also proves the process worked.

Read More : How to Become a Software Engineer: Education, Steps & Tips for Success

Arc Signup Call-to-Action Banner v.1

Final Thoughts

Developing problem-solving skills is quite necessary for software developers. To be a successful problem solver, you will need lots of years down the line to practice what you study.

Always remember that you are a problem solver first before anything else. There is more to building software than just understanding the tech behind it and writing lines of code. It’s all about improving your ability to identify problems and find solutions, and that will need lots of experience on your part.

Never shy away from problems, but learn to think critically and logically in any situation. By applying the six-step strategy for problem-solving at work discussed in this piece, you will be more equipped to come up with the most effective and efficient solutions.

We hope you enjoyed reading our guide on how to solve a problem as a software developer and ways to improve skills as a problem solver! If you have any questions, feedback, or other great problem-solving techniques or methods, let us know in the comments below 🙂

' src=

The Arc team publishes insightful articles and thought leadership pieces related to software engineering careers and remote work. From helping entry-level developers land their first junior role to assisting remote workers struggling with working from home to guiding mid-level programmers as they seek a leadership position, Arc covers it all and more!

Join the discussion Cancel reply

Save my name, email, and website in this browser for the next time I comment.

Further reading

How to Move Into a More Senior Role as a Software Developer leader management or leadership position

Ready to Take On a Senior Role or Leadership Position as a Developer?

how to improve problem solving in programming

Here Are 43 of the Best Online Developer Communities to Join in 2024

How to know when you can consider yourself a senior software developer or engineer

Here’s When You Can TRULY Call Yourself a “Senior” Software Developer

how to improve time management skills for remote workers and managing time effectively as a software developer

Time Management Skills for Developers: Best Tips, Tools, and Strategies

Do I Need a Software Engineering Degree for Software Development Jobs?

Software Engineer Degree: Pros, Cons & Alternatives

how to improve analytical skills for developers

Key Analytical Skills for Developers (& How to Continually Improve Them)

how to improve problem solving in programming

Member-only story

10 Steps to Solving a Programming Problem

Tips for new developers staring at a blank screen, unsure of where to start.

Valinda Chan

Valinda Chan

Some of the feedback I hear from new developers working on a programming problem revolves around uncertainty of where to start. You understand the problem, the logic, basics of the syntax, etc. If you see someone else’s code or have someone to guide you, you can follow along. But maybe you feel uncertain about doing it yourself and have trouble turning your thoughts into code at first even though you understand the syntax or logic. Here’s my process and some tips to tackling a sample problem that hopefully some of you may find helpful in your journey.

1. Read the problem at least three times (or however many makes you feel comfortable)

You can’t solve a problem you don’t understand. There is a difference between the problem and the problem you think you are solving. It’s easy to start reading the first few lines in a problem and assume the rest of it because it’s similar to something you’ve seen in the past. If you are making even a popular game like Hangman, be sure to read through any rules even if you’ve played it before. I once was asked to make a game like Hangman that I realized was “Evil Hangman” only after I read through the instructions (it was a trick!).

Sometimes I’ll even try explaining the problem to a friend and see if her understanding of my explanation matches the problem I am tasked with. You don’t want to find out halfway through that you misunderstood the problem. Taking extra time in the beginning is worth it. The better you understand the problem, the easier it will be to solve it.

Let’s pretend we are creating a simple function selectEvenNumbers that will take in an array of numbers and return an array evenNumbers of only even numbers. If there are no even numbers, return the empty array evenNumbers .

Here are some questions that run through my mind:

  • How can a computer tell what is an even number? Divide that number by 2 and see if its remainder is 0.
  • What am I passing into this function? An array
  • What will that array contain? One or more numbers
  • What are the data types of the elements in the array? Numbers
  • What is the goal of this function? What am I returning at the end of this function? The goal is to take all the even numbers and return them in an array. If there are no even numbers, return an empty array.

2. Work through the problem manually with at least three sets of sample data

Take out a piece of paper and work through the problem manually. Think of at least three sets of sample data you can use. Consider corner and edge cases as well.

Corner case : a problem or situation that occurs outside of normal operating parameters, specifically when multiple environmental variables or conditions are simultaneously at extreme levels, even though each parameter is within the specified range for that parameter. Edge case : problem or situation that occurs only at an extreme (maximum or minimum) operating parameter

For example, below are some sets of sample data to use:

When you are first starting out, it is easy to gloss over the steps. Because your brain may already be familiar with even numbers, you may just look at a sample set of data and pull out numbers like 2 , 4 , 6 and so forth in the array without fully being aware of each and every step your brain is taking to solve it. If this is challenging, try using large sets of data as it will override your brain’s ability to naturally solve the problem just by looking at it. That helps you work through the real algorithm.

Let’s go through the first array [1]

  • Look at the only element in the array [1]
  • Decide if it is even. It is not
  • Notice that there are no more elements in this array
  • Determine there are no even numbers in this provided array
  • Return an empty array

Let’s go through the array [1, 2]

  • Look at the first element in array [1, 2]
  • Look at the next element in the array
  • Decide if it is even. It is even
  • Make an array evenNumbers and add 2 to this array
  • Return the array evenNumbers which is [2]

I go through this a few more times. Notice how the steps I wrote down for [1] varies slightly from [1, 2] . That is why I try to go through a couple of different sets. I have some sets with just one element, some with floats instead of just integers, some with multiple digits in an element, and some with negatives just to be safe.

3. Simplify and optimize your steps

Look for patterns and see if there’s anything you can generalize. See if you can reduce any steps or if you are repeating any steps.

  • Create a function selectEvenNumbers
  • Create a new empty array evenNumbers where I store even numbers, if any
  • Go through each element in the array [1, 2]
  • Find the first element
  • Decide if it is even by seeing if it is divisible by 2. If it is even, I add that to evenNumbers
  • Find the next element
  • Repeat step #4
  • Repeat step #5 and #4 until there are no more elements in this array
  • Return the array evenNumbers , regardless of whether it has anything in it

This approach may remind you of Mathematical Induction in that you:

  • Show it is true for n = 1 , n = 2 , ...
  • Suppose it is true for n = k
  • Prove it is true for n = k + 1

4. Write pseudocode

Even after you’ve worked out general steps, writing out pseudocode that you can translate into code will help with defining the structure of your code and make coding a lot easier. Write pseudocode line by line. You can do this either on paper or as comments in your code editor. If you’re starting out and find blank screens to be daunting or distracting, I recommend doing it on paper.

Pseudocode generally does not actually have specific rules in particular but sometimes, I might end up including some syntax from a language just because I am familiar enough with an aspect of the programming language. Don’t get caught up with the syntax. Focus on the logic and steps.

For our problem, there are many different ways to do this. For example, you can use filter but for the sake of keeping this example as easy to follow along as possible, we will use a basic for loop for now (but we will use filter later when we refactor our code).

Here is an example of pseudocode that has more words:

Here is an example of pseudocode that has fewer words:

Either way is fine as long as you are writing it out line-by-line and understand the logic on each line.

Refer back to the problem to make sure you are on track.

5. Translate pseudocode into code and debug

When you have your pseudocode ready, translate each line into real code in the language you are working on. We will use JavaScript for this example.

If you wrote it out on paper, type this up as comments in your code editor. Then replace each line in your pseudocode.

Then I call the function and give it some sample sets of data we used earlier. I use them to see if my code returns the results I want. You can also write tests to check if the actual output is equal to the expected output.

I generally use console.log() after each variable or line or so. This helps me check if the values and code are behaving as expected before I move on . By doing this, I catch any issues before I get too far. Below is an example of what values I would check when I am first starting out. I do this throughout my code as I type it out.

After working though each line of my pseudocode, below is what we end up with. // is what the line was in pseudocode. Text that is bolded is the actual code in JavaScript.

I get rid of the pseudocode to avoid confusion.

Sometimes new developers will get hung up with the syntax that it becomes difficult to move forward. Remember that syntax will come more naturally over time and there is no shame in referencing material for the correct syntax later on when coding.

6. Simplify and optimize your code

You’ve probably noticed by now that simplifying and optimizing are recurring themes.

“Simplicity is prerequisite for reliability.” — Edsger W. Dijkstra, Dutch computer scientist and early pioneer in many research areas of computing science

In this example, one way of optimizing it would be to filter out items from an array by returning a new array using filter . This way, we don’t have to define another variable evenNumbers because filter will return a new array with copies of elements that match the filter. This will not change the original array. We also don’t need to use a for loop with this approach. filter will go through each item, return either true , to have that element in the array, or false to skip it.

Simplifying and optimizing your code may require you to iterate a few times, identifying ways to further simplify and optimize code.

Here are some questions to keep in mind:

  • What are your goals for simplifying and optimizing? The goals will depend on your team’s style or your personal preference. Are you trying to condense the code as much as possible? Is the goal to make it the code more readable? If that’s the case, you may prefer taking that extra line to define the variable or compute something rather than trying to define and compute all in one line.
  • How else can you make the code more readable?
  • Are there any more extra steps you can take out?
  • Are there any variables or functions you ended up not even needing or using?
  • Are you repeating some steps a lot? See if you can define in another function.
  • Are there better ways to handle edge cases?
“Programs must be written for people to read, and only incidentally for machines to execute.” — Gerald Jay Sussman and Hal Abelson, Authors of “Structure and Interpretation of Computer Programs”

This step really should be throughout the process. Debugging throughout will help you catch any syntax errors or gaps in logic sooner rather than later. Take advantage of your Integrated Development Environment (IDE) and debugger. When I encounter bugs, I trace the code line-by-line to see if there was anything that did not go as expected. Here are some techniques I use:

  • Check the console to see what the error message says. Sometimes it’ll point out a line number I need to check. This gives me a rough idea of where to start, although the issue sometimes may not be at this line at all.
  • Comment out chunks or lines of code and output what I have so far to quickly see if the code is behaving how I expected. I can always uncomment the code as needed.
  • Use other sample data if there are scenarios I did not think of and see if the code will still work.
  • Save different versions of my file if I am trying out a completely different approach. I don’t want to lose any of my work if I end up wanting to revert back to it!
“The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.” — Brian W. Kernighan, Computer Science Professor at Princeton University

8. Write useful comments

You may not always remember what every single line meant a month later. And someone else working on your code may not know either. That’s why it’s important to write useful comments to avoid problems and save time later on if you need to come back to it.

Stay away from comments such as:

// This is an array. Iterate through it.

// This is a variable

I try to write brief, high-level comments that help me understand what’s going on if it is not obvious. This comes in handy when I am working on more complex problems. It helps understand what a particular function is doing and why. Through the use of clear variable names, function names, and comments, you (and others) should be able to understand:

  • What is this code for?
  • What is it doing?

9. Get feedback through code reviews

Get feedback from your teammates, professors, and other developers. Check out Stack Overflow . See how others tackled the problem and learn from them. There are sometimes several ways to approach a problem. Find out what they are and you’ll get better and quicker at coming up with them yourself.

“No matter how slow you are writing clean code, you will always be slower if you make a mess.” — Uncle Bob Martin, Software Engineer and Co-author of the Agile Manifesto

10. Practice, practice, practice

Even experienced developers are always practicing and learning. If you get helpful feedback, implement it. Redo a problem or do similar problems. Keep pushing yourself. With each problem you solve, the better a developer you become. Celebrate each success and be sure to remember how far you’ve come. Remember that programming, like with anything, comes easier and more naturally with time.

“Take pride in how far you’ve come. Have faith in how far you can go. But don’t forget to enjoy the journey.” — Michael Josephson, Founder of Joseph and Edna Josephson Institute of Ethics

Thanks Gavin Stark

Valinda Chan

Written by Valinda Chan

Product & UX Design

More from Valinda Chan and codeburst

Getting it right: why infographics are not the same as data visualizations

Getting it right: why infographics are not the same as data visualizations

A rundown on the key differences and ideas for when to use each.

How To Create Horizontal Scrolling Containers

How To Create Horizontal Scrolling Containers

As a front end developer, more and more frequently i am given designs that include a horizontal scrolling component. this has become….

Top 50 Java Interview Questions for Beginners and Junior Developers

Top 50 Java Interview Questions for Beginners and Junior Developers

A list of frequently asked java questions and answers from programming job interviews of java developers of different experience..

Leading with the Power of Influence vs. Positional Power

ThinkGrowth.org

Leading with the Power of Influence vs. Positional Power

Getting people to take risks in a risk-averse environment, recommended from medium.

I Built an App in 6 Hours that Makes $1,500/Mo

Artturi Jalli

I Built an App in 6 Hours that Makes $1,500/Mo

Copy my strategy.

Advice From a Software Engineer With 8 Years of Experience

Benoit Ruiz

Better Programming

Advice From a Software Engineer With 8 Years of Experience

Practical tips for those who want to advance in their careers.

how to improve problem solving in programming

General Coding Knowledge

how to improve problem solving in programming

Stories to Help You Grow as a Software Developer

how to improve problem solving in programming

Coding & Development

how to improve problem solving in programming

ChatGPT prompts

Roadmap to Learn AI in 2024

Benedict Neo

bitgrit Data Science Publication

Roadmap to Learn AI in 2024

A free curriculum for hackers and programmers to learn ai.

System Design Interview Question: Design Spotify

Hayk Simonyan

Level Up Coding

System Design Interview Question: Design Spotify

High-level overview of a system design interview question - design spotify..

Apps I Use And Why You Should Too.

Gowtham Oleti

Apps I Use And Why You Should Too.

Let’s skip past the usual suspects like youtube, whatsapp and instagram. i want to share with you some less familiar apps that have become….

Ten Habits that will get you ahead of 99% of People

Alexandru Lazar

ILLUMINATION

Ten Habits that will get you ahead of 99% of People

Improve your life and get ahead of your peers in 10 simple steps.

Text to speech

Problem Solving

Foundations course, introduction.

Before we start digging into some pretty nifty JavaScript, we need to begin talking about problem solving : the most important skill a developer needs.

Problem solving is the core thing software developers do. The programming languages and tools they use are secondary to this fundamental skill.

From his book, “Think Like a Programmer” , V. Anton Spraul defines problem solving in programming as:

Problem solving is writing an original program that performs a particular set of tasks and meets all stated constraints.

The set of tasks can range from solving small coding exercises all the way up to building a social network site like Facebook or a search engine like Google. Each problem has its own set of constraints, for example, high performance and scalability may not matter too much in a coding exercise but it will be vital in apps like Google that need to service billions of search queries each day.

New programmers often find problem solving the hardest skill to build. It’s not uncommon for budding programmers to breeze through learning syntax and programming concepts, yet when trying to code something on their own, they find themselves staring blankly at their text editor not knowing where to start.

The best way to improve your problem solving ability is by building experience by making lots and lots of programs. The more practice you have the better you’ll be prepared to solve real world problems.

In this lesson we will walk through a few techniques that can be used to help with the problem solving process.

Lesson overview

This section contains a general overview of topics that you will learn in this lesson.

  • Explain the three steps in the problem solving process.
  • Explain what pseudocode is and be able to use it to solve problems.
  • Be able to break a problem down into subproblems.

Understand the problem

The first step to solving a problem is understanding exactly what the problem is. If you don’t understand the problem, you won’t know when you’ve successfully solved it and may waste a lot of time on a wrong solution .

To gain clarity and understanding of the problem, write it down on paper, reword it in plain English until it makes sense to you, and draw diagrams if that helps. When you can explain the problem to someone else in plain English, you understand it.

Now that you know what you’re aiming to solve, don’t jump into coding just yet. It’s time to plan out how you’re going to solve it first. Some of the questions you should answer at this stage of the process:

  • Does your program have a user interface? What will it look like? What functionality will the interface have? Sketch this out on paper.
  • What inputs will your program have? Will the user enter data or will you get input from somewhere else?
  • What’s the desired output?
  • Given your inputs, what are the steps necessary to return the desired output?

The last question is where you will write out an algorithm to solve the problem. You can think of an algorithm as a recipe for solving a particular problem. It defines the steps that need to be taken by the computer to solve a problem in pseudocode.

Pseudocode is writing out the logic for your program in natural language instead of code. It helps you slow down and think through the steps your program will have to go through to solve the problem.

Here’s an example of what the pseudocode for a program that prints all numbers up to an inputted number might look like:

This is a basic program to demonstrate how pseudocode looks. There will be more examples of pseudocode included in the assignments.

Divide and conquer

From your planning, you should have identified some subproblems of the big problem you’re solving. Each of the steps in the algorithm we wrote out in the last section are subproblems. Pick the smallest or simplest one and start there with coding.

It’s important to remember that you might not know all the steps that you might need up front, so your algorithm may be incomplete -— this is fine. Getting started with and solving one of the subproblems you have identified in the planning stage often reveals the next subproblem you can work on. Or, if you already know the next subproblem, it’s often simpler with the first subproblem solved.

Many beginners try to solve the big problem in one go. Don’t do this . If the problem is sufficiently complex, you’ll get yourself tied in knots and make life a lot harder for yourself. Decomposing problems into smaller and easier to solve subproblems is a much better approach. Decomposition is the main way to deal with complexity, making problems easier and more approachable to solve and understand.

In short, break the big problem down and solve each of the smaller problems until you’ve solved the big problem.

Solving Fizz Buzz

To demonstrate this workflow in action, let’s solve a common programming exercise: Fizz Buzz, explained in this wiki article .

Understanding the problem

Write a program that takes a user’s input and prints the numbers from one to the number the user entered. However, for multiples of three print Fizz instead of the number and for the multiples of five print Buzz . For numbers which are multiples of both three and five print FizzBuzz .

This is the big picture problem we will be solving. But we can always make it clearer by rewording it.

Write a program that allows the user to enter a number, print each number between one and the number the user entered, but for numbers that divide by 3 without a remainder print Fizz instead. For numbers that divide by 5 without a remainder print Buzz and finally for numbers that divide by both 3 and 5 without a remainder print FizzBuzz .

Does your program have an interface? What will it look like? Our FizzBuzz solution will be a browser console program, so we don’t need an interface. The only user interaction will be allowing users to enter a number.

What inputs will your program have? Will the user enter data or will you get input from somewhere else? The user will enter a number from a prompt (popup box).

What’s the desired output? The desired output is a list of numbers from 1 to the number the user entered. But each number that is divisible by 3 will output Fizz , each number that is divisible by 5 will output Buzz and each number that is divisible by both 3 and 5 will output FizzBuzz .

Writing the pseudocode

What are the steps necessary to return the desired output? Here is an algorithm in pseudocode for this problem:

Dividing and conquering

As we can see from the algorithm we developed, the first subproblem we can solve is getting input from the user. So let’s start there and verify it works by printing the entered number.

With JavaScript, we’ll use the “prompt” method.

The above code should create a little popup box that asks the user for a number. The input we get back will be stored in our variable answer .

We wrapped the prompt call in a parseInt function so that a number is returned from the user’s input.

With that done, let’s move on to the next subproblem: “Loop from 1 to the entered number”. There are many ways to do this in JavaScript. One of the common ways - that you actually see in many other languages like Java, C++, and Ruby - is with the for loop :

If you haven’t seen this before and it looks strange, it’s actually straightforward. We declare a variable i and assign it 1: the initial value of the variable i in our loop. The second clause, i <= answer is our condition. We want to loop until i is greater than answer . The third clause, i++ , tells our loop to increment i by 1 every iteration. As a result, if the user inputs 10, this loop would print numbers 1 - 10 to the console.

Most of the time, programmers find themselves looping from 0. Due to the needs of our program, we’re starting from 1

With that working, let’s move on to the next problem: If the current number is divisible by 3, then print Fizz .

We are using the modulus operator ( % ) here to divide the current number by three. If you recall from a previous lesson, the modulus operator returns the remainder of a division. So if a remainder of 0 is returned from the division, it means the current number is divisible by 3.

After this change the program will now output this when you run it and the user inputs 10:

The program is starting to take shape. The final few subproblems should be easy to solve as the basic structure is in place and they are just different variations of the condition we’ve already got in place. Let’s tackle the next one: If the current number is divisible by 5 then print Buzz .

When you run the program now, you should see this output if the user inputs 10:

We have one more subproblem to solve to complete the program: If the current number is divisible by 3 and 5 then print FizzBuzz .

We’ve had to move the conditionals around a little to get it to work. The first condition now checks if i is divisible by 3 and 5 instead of checking if i is just divisible by 3. We’ve had to do this because if we kept it the way it was, it would run the first condition if (i % 3 === 0) , so that if i was divisible by 3, it would print Fizz and then move on to the next number in the iteration, even if i was divisible by 5 as well.

With the condition if (i % 3 === 0 && i % 5 === 0) coming first, we check that i is divisible by both 3 and 5 before moving on to check if it is divisible by 3 or 5 individually in the else if conditions.

The program is now complete! If you run it now you should get this output when the user inputs 20:

  • Read How to Think Like a Programmer - Lessons in Problem Solving by Richard Reis.
  • Watch How to Begin Thinking Like a Programmer by Coding Tech. It’s an hour long but packed full of information and definitely worth your time watching.
  • Read this Pseudocode: What It Is and How to Write It article from Built In.

Knowledge check

This section contains questions for you to check your understanding of this lesson on your own. If you’re having trouble answering a question, click it and review the material it links to.

  • What are the three stages in the problem solving process?
  • Why is it important to clearly understand the problem first?
  • What can you do to help get a clearer understanding of the problem?
  • What are some of the things you should do in the planning stage of the problem solving process?
  • What is an algorithm?
  • What is pseudocode?
  • What are the advantages of breaking a problem down and solving the smaller problems?

Additional resources

This section contains helpful links to other content. It isn’t required, so consider it supplemental.

  • Read the first chapter in Think Like a Programmer: An Introduction to Creative Problem Solving ( not free ). This book’s examples are in C++, but you will understand everything since the main idea of the book is to teach programmers to better solve problems. It’s an amazing book and worth every penny. It will make you a better programmer.
  • Watch this video on repetitive programming techniques .
  • Watch Jonathan Blow on solving hard problems where he gives sage advice on how to approach problem solving in software projects.

Support us!

The odin project is funded by the community. join us in empowering learners around the globe by supporting the odin project.

IMAGES

  1. 6 Ways to Improve Your Programming Problem Solving

    how to improve problem solving in programming

  2. Tips to Improve Problem-Solving Skills in Programming

    how to improve problem solving in programming

  3. Problem Solving In Programming

    how to improve problem solving in programming

  4. how to solve problem by programming

    how to improve problem solving in programming

  5. problem solving approach in programming

    how to improve problem solving in programming

  6. 5 steps to improve problem solving skills

    how to improve problem solving in programming

VIDEO

  1. How to improve problem solving skills #problem

  2. 100 Day Coding Challenge #study #coding #challenge #softwareengineer #dsa

  3. Techniques of Problem solving in Programming

  4. Prefix sum array شرح || Problem solving

  5. Partial Sum شرح || Problem Solving

  6. JS Problem Solving Questions 01

COMMENTS

  1. 6 Ways to Improve Your Programming Problem Solving - 7pace

    Critical thinking. Communication. Teamwork. Focusing on building and practicing all these skills will help you improve your problem solving. Problem solving is one of the most necessary skills for developers to have. With time, practice, and dedication, they can improve it, constantly, and keep becoming better.

  2. How to think like a programmer — lessons in problem solving

    Simplest means you know the answer (or are closer to that answer). After that, simplest means this sub-problem being solved doesn’t depend on others being solved. Once you solved every sub-problem, connect the dots. Connecting all your “sub-solutions” will give you the solution to the original problem. Congratulations!

  3. How to Develop Problem Solving Skills in Programming ...

    The way to approach problems is the key to improving the skills. To find a solution, a positive mindset helps to solve problems quickly. If you think something is impossible, then it is hard to achieve. When you feel free and focus with a positive attitude, even complex problems will have a perfect solution.

  4. How to Solve Coding Problems with a Simple Four Step Method

    In this post, we’ve gone over the four-step problem-solving strategy for solving coding problems. Let's review them here: Step 1: understand the problem. Step 2: create a step-by-step plan for how you’ll solve it. Step 3: carry out the plan and write the actual code.

  5. Hands-on Tutorial: How To Improve Your Problem-Solving Skills ...

    Programming is ultimately problem-solving. We only apply the programming language to express how we’ve thought about a problem and the approach we’re using to solve it. The worst thing you could do is to start chipping away at the problem once it’s presented. This is where most newbie programmers get stuck and give up.

  6. Problem-Solving Strategies for Software Engineers - Codecademy

    Write out the problem. Your problem won’t always come right out and say: “It’s me, hi. I’m the problem, it’s me.”. In fact, something that often gets in the way of solving a problem is that we zero in on the wrong problem. When pinpointing a problem, you can try borrowing a UX research technique that’s part of the design thinking ...

  7. 3 Tips to Solve Problems Like an Expert | Better Programming

    Interactive debugging. Log-file analysis. Unit and integration test. Analyze the bundle file if the problem is related to the web performance. 3. Use Spectrum Thinking Instead of Binary Thinking. Binary thinking is always putting things in terms of two alternatives that are usually mutually exclusive.

  8. Problem-Solving Skills for Software Developers: Why & How to ...

    To train the problem-solving side of your brain, these four tips and strategies can help you improve your abilities: 1. Make problem-solving a part of your life. Never restrict yourself to working on problems only during work hours. Don’t make it a chore, but, instead, do things that make problem-solving look fun.

  9. 10 Steps to Solving a Programming Problem - codeburst

    The goal is to take all the even numbers and return them in an array. If there are no even numbers, return an empty array. 2. Work through the problem manually with at least three sets of sample data. Take out a piece of paper and work through the problem manually.

  10. Problem Solving | The Odin Project

    The best way to improve your problem solving ability is by building experience by making lots and lots of programs. The more practice you have the better you’ll be prepared to solve real world problems. In this lesson we will walk through a few techniques that can be used to help with the problem solving process. Lesson overview