Pre-work reading
Resources:
How to Solve Programming Problems
Common mistakes:
- Trying to start writing code as soon as possible
- Trying to over solve the solution on the first iteration
Set of steps to solve programming problems:
- 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.
How to think like a programmer
“Everyone in this country should learn to program a computer, because it teaches you to think.” — Steve Jobs
The best way to solve problems involves:
- Having a framework.
- Practicing it.
Framework:
- Understand it
- Know exactly what is being asked. Most hard problems are hard because you don’t understand them.
- Write down your problem, doodle a diagram, or tell someone else about it.
- Plan it
- Don’t dive right into solving without a plan. Plan your solution!
- Give your brain time to analyze the problem and process the information.
- Divide it
- Do not try to solve one big problem.
- Break it into sub-problems, then, solve each sub-problem one by one. Begin with the simplest.
If you are stuck…
- Debug
- Go step by step through your solution trying to find where you went wrong.
- Reassess
- Take a step back. Look at the problem from another perspective.
- Sidenote
- Another way of reassessing is starting anew. Delete everything and begin again with fresh eyes.
5 Whys technique
5 Whys technique (sometimes known as 5Y) is a simple but powerful tool for cutting quickly through the outward symptoms of a problem to reveal its underlying causes, so that you can deal with it once and for all.
Sakichi Toyoda, the Japanese industrialist, inventor, and founder of Toyota Industries, developed the 5 Whys technique in the 1930s
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.
- Define the Problem
- Observe the problem in action. Discuss it with your team and write a brief, clear problem statement that you all agree on.
- Write your statement on a whiteboard or sticky note, leaving enough space around it to add your answers to the repeated question, “Why?”
- Ask the First “Why?”
- Ask your team why the problem is occurring.
- 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
- Each time, frame the question in response to the answer you’ve just recorded.
- Know When to Stop
- Stop asking why when the responses are no longer useful
- Address the Root Cause(s)
- If you 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.