Solving new challenges can be hard. The harder it is, the more rewarding a solution feels. Sometimes, solutions written by other people work as a miraculous food for thought that opens doors into concepts you never thought of before. I would like this blog to be more than a reference that you know to visit when you are on search for solutions that you can copy-paste into the appropriate test window. I first started it as a self reference to keep track of my learning. The user base grows with every day and I think that we can do something positive with it. Not only will it support our learning process, but it will create interesting networking opportunities as well.
When I started solving my first challenges, I thought that I knew the best possible approach straight out of the blue. Don’t worry, I see my mistake by now. I realized, that my way of looking at things, was very limited. Not only I did not have the required concrete strategies (special trees, dynamic programming, union-find…) that I could apply and modify, but I was locked in my own perspective. It feels like running in a glorified hamster wheel. You might improve your leg work and run faster, but you do not get any further. I believe that this is very common and sadly, it does not get better the better you get.
A few years ago, I made a deal with myself that I will not only read technical books (like Effective C++) but also books on cognition, creativity, project management, rationality, etc. to lighten up the mood a bit. (This list might explain why I am unable to finish the Ender’s saga…). Why am I telling you this? Well, because I just finished reading Conceptual Blockbusting (a great light read I highly recommend) and it won’t improve my C++ code, but it will do something much more important. It will improve my thinking! The book was written in the 80’ties and interestingly, many things remain unchanged. We solve more digital problems and less mechanical ones, true. Yet, we are still haunted by the same conceptual blocks and we still know nothing about the brain (almost like Jon Snow does). This book shows us, based on relevant research not just people on the internet, how strongly our thinking process is impaired thus encouraging us to break out of the box.
So, why am I writing this post? Because I was wondering whether posting a solution to a challenge actually helps anyone. Do you, my visitors, take the time to understand my approach, or do you just see the code? It helped me a lot in the beginning (and without any shadow of doubt it still does) when I could disassemble someone else’s code and analyze it like a dead frog. It is extremely hard to understand the thinking process behind challenges you find on pages like TopCoder, where the first solution you find might be optimal, but it is just a heap of code that not help much. The algorithm archive is great if you already have a great algorithmic vocabulary and you want to check other (maybe more elegant) solutions. But personally, I am not that far yet. I look at a solution and think: “Great. Why that?” I do not think that the knowledge translates as a use-later pattern into my long term memory. It is therefore just code, not a way to express an idea.
To learn, you need to extract the patterns (algorithms) and be able to use them again when appropriate. I have to admit, that even now, with many resources online, there is no great resource that guides you through. (that is what universities should be doing and not GeeksForGeeks. Right?). Most successful algorithms weren’t developed in 20 minutes. They took time to conceive and consequently they require time to learn, and use when appropriate. Usually, all you need to understand an elegant solution is the name of the algorithm (or concept) used in the process. There will be some page, blog or white paper out there that explains how it works. That is when code becomes an idea.
The mind is a wonderful thing, it is understood better and better every day. Yet by only knowing how our brain cells operate and communicate, we have no idea how to improve the process in it’s entirety. I would like to engage in a meaningful conversation about the thinking process with you. What did you think first? How did you find the solution? Why did you discard other ones? Did you think of a solution while seeing another challenge?
So, how do we do this? By indulging ourselves to Pair Programming? I will be completely honest with you. It does not help. Or at least it does not help me. Did you ever pair program on hard tasks? I did not. To solve hard problems, I need space, time and the freedom to consult issues after I’ve managed to boil them down to one simple question. Pair programming so far only helped me catch off-by-one errors, return value checks in legacy C code, and streamline the code writing process in general. Does it help my code to suck less? Sure! Does it help myself to become a better thinker? Nah!
Let us get on a more positive note. Over the last few months I managed to organize a few coding challenge evenings. They included a Coding Challenge (or more) and a few Scottish whiskeys (usually more than challenges). It was one of the few moments where I had the chance to see a different mind from mine in operation. Other people see patterns in the challenge description you might never notice and it works the other way around as well. It is truly fascinating. Not only you see where the conceptual blocks of the other persons lie, but you also allow yourself to identify such blocks of your own.
So dear subscribers, organic searchers, random visitors and family members that just follow any link I post: Would you be interested in a more engaging interaction? Are you willing to verbalize your thinking process? I would like to know, how you arrived at this Aha! Moment that allowed you to find a great solution. Are there any tactics you use to get out of your thinking stereotypes or are you a prisoner of your own conceptual blocks? If you find some of my previous solutions weird, feel free to ask how I came by it. I will try to verbalize the process. It helps you, in your learning process, and it helps me, to better grasp the concepts by speaking about them.
You, myself, a squadron of monkeys with typewriters, everyone who pushes their limits gets to a point where solving a new challenge becomes child’s play (at least those labeled as easy and medium). You can recognize more and more ways of solving a challenge by growing your algorithmic vocabulary. You need to find an element in a list? You think of binary search. You need to find a specific value in an interval? Segment trees. Yet there will never be a level where seeing other solutions will be of no use to you anymore. If this would be true, there would be no more innovations in this world. There are always people at your level, whatever that level might be,
that benefit from a meaningful conversation.
I am therefore not ashamed of taking hours or maybe days to find the pattern to some of the harder problems I have encountered so far. They emerged eventually and the moment allowed some of my brain cells to find new connections with other, also lonely neighbors. Wanna make some more?
If you enjoyed this post, then make sure you subscribe to my Newsletter and/or Feed.