Solving Problems
a simple set of steps to follow which you can use for any algorithm type programming problem.
- 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.
Many times you will find that a problem itself involves multiple large steps or is very complicated. In those instances, you will want to try and find a way to cut the problem directly in half and then following the process above for each half.
Act like you make $1000/hr
- many people could be making a fortune (if they used their time well)…but instead, they give away their time in unproductive ways that leave them broke, unhappy, and stuck.
“Most people have no clue what they are doing with their time but still complain that they don’t have enough.” -Grant Cardone, NYT best-selling author
- Busyness and Stress Are the Enemy
For world-class performers, busyness and stress are the enemy. They’re a sign you’re off-track. It means you’ve been lazy and undisciplined, and have let too many unimportant tasks take you away from what really matters.
“When you have less time available for work, you have to make better choices about what to work on (and what not to).” -Tim Metz
- As You Think, So You Are
If you let people know your time is free and low-valued, people will treat it as such,But if you teach people that your time is expensive, important, and valuable, then people will respond in kind.
“People are unhappy in large part because they are confused about what is valuable.” -William Irvine
If you don’t treat yourself and your time with respect, you will become unhappy, resentful, and tired. Your body and mind long for mastery and freedom; you can’t have those things if your time is cheap and easily taken.
- You Can Do Amazing Things, But Only If You Have Time to Do Them.
“The difference between successful people and really successful people is that really successful people say no to almost everything.” -Warren Buffet
Every time you say yes to something, it means you’re saying “no” to a dozen other opportunities. The world’s most successful and extraordinary people say no to almost everything, but yes to a few things.
This process of weeding out the merely “good” for the truly great opportunities is easier when you value your time at $1,000/hour.
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 problem involves a) having a framework and b) practicing it.
“Almost all employers prioritize problem-solving skills first. Problem-solving skills are almost unanimously the most important qualification that employers look for….more than programming languages proficiency, debugging, and system design. Demonstrating computational thinking or the ability to break down large, complex problems is just as valuable (if not more so) than the baseline technical skills required for a job.” — Hacker Rank (2018 Developer Skills Report).
the steps you should do when you encounter a new problem :
- 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).
“If you can’t explain something in simple terms, you don’t understand it.” — Richard Feynman
- Plan
Don’t dive right into solving without a plan (and somehow hope you can muddle your way through). Plan your solution!,In programming, this means don’t start hacking straight away. Give your brain time to analyze the problem and process the information.
- Divide
Do not try to solve one big problem,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,Once you solved every sub-problem, connect the dots,Connecting all your “sub-solutions” will give you the solution to the original problem. Congratulations!.
- Stuck
**here are three things to try when Stuck:
- 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).
Another way of reassessing is starting anew. Delete everything and begin again with fresh eyes.
- 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).
Caveat: Don’t look for a solution to the big problem. Only look for solutions to sub-problems. Why? Because unless you struggle (even a little bit), you won’t learn anything. If you don’t learn anything, you wasted your time.
- 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!
### 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
The model follows a very simple seven-step process:
- 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
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
- Ask the First “Why?”
Ask your team why the problem is occurring,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.
Tip:
Try to move quickly from one question to the next, so that you have the full picture before you jump to any conclusions.
- 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
- 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.
Refrences :