The Art of Thinking
I had been sitting in front of my laptop for over 30 minutes with absolutely no progress. Not the kind of stuck where all lines of thinking prove fruitless or being stuck simply from a lack of effort, I was stuck because I didn’t know where to put my effort. The notes I had written weren’t pieces of a puzzle that would lead to an elegant solution; but rather, an incoherent jumble of ideas whose only destination was nowhere. I didn’t know how to think.
Structure
Have you ever thought about how you think about problems? Although it seems like a simple task of just finding the correct solution, the steps you take to reach the end aren’t always so well defined. While reading Cal Newport’s book, “Deep Work”, I found that his 3 step process for thinking about problems fit perfectly for competitive programming.
- Review the relevant variables: the bounds, time and problem constraints, knowledge already acquired.
- Define a next-step question: “How can I find the k-th number in the sequence, etc.”
- Consolidate the answer and repeat until you have the final solution.
Although none of these steps are revolutionary or mind boggling independently, they provide a vital framework for productively thinking about problems.
Step 1 Problems
Being stuck in Step 1 comes down to two causes: lack of knowledge or “looping”. If you simply didn’t know an algorithm or data structure needed to solve the problem, a Google search and some practice is enough to fix that up. “Looping” is as the name suggests, continuing to review the variables you have without asking further questions to make progress. Because it’s human nature to take the path of least resistance, you have to be on constant watch to make sure you aren’t looping.
Step 2 Problems
Observations are important for a reason, they answer a question the problem poses. To not find the underlying question or be able to find the subsequent observation needed classifies as a missed observation. It’s important in these cases to truly understand the logic behind the observation/problem and tie it back to your thinking, so it becomes a new tool in your repertoire and not just a one-off technique. To find the question but answer it incorrectly reclassifies your mistake as a misevaluation. These are often small logic errors, like thinking you can’t precompute when the constraints are small enough, which make them easy to fix with a simple note to not make that same mistake in the future. Speaking of notes…
Notes
Let’s imagine solving problems as finding your way to a friend’s house. The houses on each road share some distinct features (color, shape, size) and each house has a random number. You’re given one of those defining features and the number of the house. Also your friend moves each time you find him because he’s a terrible friend. To rely solely on your own memory as a journal of the roads you took poses a glaringly obvious problem: you won’t be able to retrace all the wrong paths you took. You might have taken roads with orange houses because you thought orange was a shade of blue but forgotten in your flurry of rage that your friend moves houses EVERY. SINGLE. TIME. I know I’m pushing the analogy here, but the point still stands. Taking notes on your thoughts isn’t only important to figure out what you did right, but also what you did wrong. Even when you correctly solve problems, there are almost always ideas you had that went nowhere. Each little mistake by itself might not seem worth fixing, but cumulatively they make for a lot of wasted time and energy. Notes help you find these dead ends and eliminate the inefficiencies out of your thinking.
Outro
As always, I hope you’ve enjoyed and learned something from this post. I know I haven’t followed my original schedule of a post per week, but I would rather put out no content than some half finished post that leaves both the reader and myself disappointed. I’m off to find that annoying friend again, until next time!
If you enjoyed this post, you can get notified of future ones here!