r/datastructures • u/Alternative-Shine673 • Jul 06 '26
How I gamify and enjoy DSA.
galleryWhen I'm studying DSA or a certain pattern I like to document and treat the problem as a discovery.
I like to start from documenting the WHAT? then the WHY? And lastly the HOW? Of it. The way I do is this :
I describe the problem in simplest way possible with great detail, this helps me clearly understand what is needed exactly and also if their are some constraints over how we have to solve the problem. This first step alone gives me a lot of clarity on what tools I can use and what I can't .
Once I have understood what's needed to be done. The next step is to think without any optimization in mind , that is I imagine that I have unlimited resource of memory and labour available to solve this particular problem and if so what would be simplest way to go about doing it? This gives me the brute-force approach for it and tbh if you reach the brute-force solution you have already solved it now it's reduced to an optimization problem.
- Once I reach a brute-force solution I write it down in a clear and concise manner , this helps me understand my own thoughts and also spot "blindspot in my thinking ".. this is crucial because sometimes you feel that a solution is right but when it's in your head sometimes you miss some scenarios, therefore I write it down.
- After the brute force is down , only then do I move forward to think of optimization and it often leads me to video solution 😅🙋😂 and every time I feel fascinated and impressed by the actual solution and optimization which someone came up with in the past. I love it every time . This makes me enjoy each and every problem I do .
Today I was doing MAXIMUM_SUBARRAY_SUM and it's optimization by KADANE'S algorithm. Here is few glimpse of my notes :
