How to Solve Programming Problems
- The most common mistake is try to start writing code as soon as possible.
- nother big mistake is trying to over solve the solution on the first iteration.
simple set of steps for any algorithm type programming problem you can use:
- Read the problem completely twice.
- Solve the problem manually with 3 sets of sample data.
- Optimize the manual steps.
- Write the manual steps as comments or pseudo-code.
- Replace the comments or pseudo-code with real code.
- Optimize the real code.
Act like you make $1000/hr
many people waste much of their time on pointless, low-quality activities that don’t help them reach their true goals — their mission. Imagine that an hour of your time is worth $1,000 What would your life look like? What people would you stop putting up with? What problems would you stop wasting time on? What things would you stop — and start — doing?
“Busyness” Isn’t a Badge of Honor; It’s a Sign of Weakness
If you let it, your world and the people around you will take all your time. Your time is not unlike your paycheck; if you don’t budget for things, you’ll have nothing left over by the end of the month.
This is how lives are wasted — by doing thankless work for ungrateful takers that didn’t deserve your time in the first place. We’re all busy — with work, our families, our friends.
How to think like a programmer — lessons in problem solving
“Everyone in this country should learn to program a computer, because it teaches you to think.” — Steve Jobs
You probably also wondered what does it mean, exactly, to think like a programmer? And how do you do it?? Essentially, it’s all about a more effective way for problem solving.
what should you do when you encounter a new problem?
Here are the steps:
1. Understand
Know exactly what is being asked. Most hard problems are hard because you don’t understand them (hence why this is the first step). How to know when you understand a problem? When you can explain it in plain English.
2. Plan
Don’t dive right into solving without a plan (and somehow hope you can muddle your way through). Plan your solution!
Nothing can help you if you can’t write down the exact steps.
In programming, this means don’t start hacking straight away. Give your brain time to analyze the problem and process the information.
3. Divide
Do not try to solve one big problem. You will cry.
Instead, break it into sub-problems. These sub-problems are much easier to solve.
Then, solve each sub-problem one by one. Begin with the simplest. 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.
4. Stuck?
In fact, here are three things to try when facing a whammy:
-
Debug: Go step by step through your solution trying to find where you went wrong. Programmers call this debugging (in fact, this is all a debugger does).
-
Reassess: Take a step back. Look at the problem from another perspective. Is there anything that can be abstracted to a more general approach?
-
Research: Ahh, good ol’ Google. You read that right. No matter what problem you have, someone has probably solved it. Find that person/ solution. In fact, do this even if you solved the problem! (You can learn a lot from other people’s solutions).
5. Practice
Don’t expect to be great after just one week. If you want to be a good problem-solver, solve a lot of problems!
Practice. Practice. Practice. It’ll only be a matter of time before you recognize that “this problem could easily be solved with insert concept here.”
6. Conclusion
The 5 Whys
- When to Use a 5 Whys Analysis
You can use 5 Whys for troubleshooting, quality improvement, and problem solving, but it is most effective when used to resolve simple or moderately difficult problems.
- How to Use the 5 Whys
- Assemble a Team
Gather together people who are familiar with the specifics of the problem, and with the process that you’re trying to fix. Include someone to act as a facilitator , who can keep the team focused on identifying effective counter-measures.
- Define the Problem
If you can, observe the problem in action. Discuss it with your team and write a brief, clear problem statement that you all agree on. For example, “Team A isn’t meeting its response time targets” or “Software release B resulted in too many rollback failures.”
- Ask the First “Why?”
Ask your team why the problem is occurring. (For example, “Why isn’t Team A meeting its response time targets?”)
Asking “Why?” sounds simple, but answering it requires serious thought. Search for answers that are grounded in fact: they must be accounts of things that have actually happened, not guesses at what might have happened.
- Ask “Why?” Four More Times
For each of the answers that you generated in Step 3, ask four further “whys” in succession. Each time, frame the question in response to the answer you’ve just recorded.
Figure 1: 5 Whys Example (Single Lane)

Figure 2: 5 Whys Example (Multiple Lanes)

- Step 5. Know When to Stop
You’ll know that you’ve revealed the root cause of the problem when asking “why” produces no more useful responses, and you can go no further. An appropriate counter-measure or process change should then become evident. (As we said earlier, if you’re not sure that you’ve uncovered the real root cause, consider using a more in-depth problem-solving technique like Cause and Effect Analysis , Root Cause Analysis , or FMEA .)
- Address the Root Cause(s)
Now that you’ve identified at least one root cause, you need to discuss and agree on the counter-measures that will prevent the problem from recurring.
- Monitor Your Measures
Keep a close watch on how effectively your counter-measures eliminate or minimize the initial problem. You may need to amend them, or replace them entirely. If this happens, it’s a good idea to repeat the 5 Whys process to ensure that you’ve identified the correct root cause.
sources © :