Prep: Engineering Topics - 401-advanced-javascript-muna/amman-javascript-401d1 GitHub Wiki

How to Solve Programming Problems:

A simple set of steps to follow which you can use for any algorithm type programming problem

  1. Read the problem completely twice.
  2. Solve the problem manually with 3 sets of sample data.
  3. Optimize the manual steps.
  4. Write the manual steps as comments or pseudo-code.
  5. Replace the comments or pseudo-code with real code.
  6. Optimize the real code. As much as 70% of our time should be spent in steps 1-3.

Pretend Your Time is Worth ,1000/Hour and You’ll Become 100x More Productive

“The most successful people I know are not busy. They’re focused.”

“People are unhappy in large part because they are confused about what is valuable.” -William Irvine

“Busyness and exhaustion should be your enemy. If you’re chronically stressed and up late working, you’re doing something wrong. Do less. But do what you do with complete, hard focus. Then when you’re done be done, and go enjoy the rest of your day.”


How to think like a programmer — lessons in problem solving:

Here are the steps when you encounter a new problem:

  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)
  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 Pay attention. This is the most important step of all. 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? By now, you’re probably sitting there thinking “Hey Richard... That’s cool and all, but what if I’m stuck and can’t even solve a sub-problem??” First off, take a deep breath. Second, that’s fair. Don’t worry though, friend. This happens to everyone! The difference is the best programmers/problem-solvers are more curious about bugs/errors than irritated

Five Whys and Five Hows What It Is

The five whys and five hows constitute a questioning process designed to drill down into the details of a problem or a solution and peel away the layers of symptoms.

Edward Hodnet, a British poet, observed, “If you don’t ask the right questions, you don’t get the right answers. A question asked in the right way often points to its own answer. Asking questions is the ABC of diagnosis. Only the inquiring mind solves problems.”

When to Use It

The five hows can be used with brainstorming and the solution-and-effect diagram to develop more details of a solution to a problem under consideration.

How to Use It

Draw a box at the top of a piece of flip chart paper and clearly write down the problem or solution to be explored. Below the statement box draw five lines in descending order. Ask the “Why” or “How” question five times and write the answers on the lines drawn from number one to five. It may take less or more than five times to reach the root cause or solutio