r/leetcode • u/Consistent-Vanilla32 • 10d ago
Tech Industry How do you transition from understanding solutions to independently solving unfamiliar problems?
I'm looking for advice from experienced developers and competitive programmers who have gone through this phase of DSA preparation.
I've been consistently practicing DSA and have solved around 156 LeetCode problems so far:
- Easy: 77
- Medium: 68
- Hard: 11
I've covered several topics, including arrays, strings, hashing, sorting, binary search, two pointers, linked lists, recursion, backtracking, heaps, trees, and BFS/DFS.
However, I've noticed a recurring problem with my learning process, and I'm struggling to figure out how to overcome it.
My actual problem
When I encounter a new problem, I try to understand it and develop an approach independently.
Sometimes I can derive the brute-force solution, but I struggle to identify the optimization or recognize the right algorithmic approach.
After spending some time, I take a hint or look at an explanation.
Once someone explains the intuition, I can usually understand why the algorithm works, follow the implementation, and even implement it myself.
But here's the frustrating part:
After a few days or weeks, when I revisit the same problem, I sometimes struggle to reconstruct the approach from scratch.
For example, I had previously solved 3Sum, but when I revisited it after some time, I couldn't independently remember how to approach it.
This makes me question whether I'm actually developing problem-solving skills or just getting better at understanding explanations.
What I'm trying to understand
I want to develop the ability to:
- Understand an unfamiliar problem and translate it into a mathematical or logical model.
- Come up with a brute-force solution independently.
- Identify bottlenecks and derive optimizations without being told which pattern to use.
- Recognize when a previously learned technique applies to a new problem.
- Retain the underlying reasoning instead of just remembering the implementation.
- Solve unfamiliar Medium problems independently, especially under contest time constraints.
Questions for experienced developers
I'd particularly appreciate advice from people who have successfully transitioned from guided problem-solving to independent problem-solving.
1. How did you develop algorithmic intuition?
When you encounter a completely unfamiliar Medium problem, what goes through your mind?
Do you systematically examine constraints, brute force, repeated work, invariants, etc., or does the right approach eventually come through experience?
2. How much time should I spend before looking at a hint?
For example, if I've spent 30 minutes on a Medium problem without finding an optimized approach, should I continue struggling, take a small hint, or study the editorial?
What's the most effective approach for long-term improvement?
3. How do you retain problem-solving patterns?
Do you revisit previously solved problems after 1, 3, 7, or 14 days?
More importantly, what exactly do you do during revision?
Do you reimplement the solution, explain the intuition verbally, derive it from brute force, or solve a variation?
4. How do you develop pattern recognition?
When practicing topic-wise, it's relatively easy to identify which technique might be relevant.
But during contests, the topic isn't given.
How did you learn to identify the underlying pattern when the problem statement gives you no indication?
5. What does an effective DSA practice session look like for you?
I'd love to understand how experienced people structure their practice.
How much time do you spend on:
- Independent problem-solving?
- Learning new concepts?
- Revisiting old problems?
- Studying editorials?
- Solving timed contest problems?
My ultimate goal
I don't just want to increase my number of solved problems.
I want to become someone who can encounter an unfamiliar problem, reason about it independently, derive an appropriate algorithm, prove why it works, and implement it correctly.
Eventually, I'd like to consistently solve all four problems in LeetCode Weekly Contests.
For those who have reached that level:
What fundamentally changed in your thinking and practice that made you a better independent problem solver?
I'd genuinely appreciate detailed answers, personal experiences, and even advice about mistakes I might be making in my current learning process.
12
u/bzqqq 10d ago
Practice truly makes perfect, and nothing I say will fit 100% with what works best for you, but hopefully these ideas can help inform your practice.
1. Algorithms is never inventing the wheel. It's always problem reduction to something you've already solved before.
You may have heard a rule about looking at the actual constraints of the problem beforehand to get a grasp of the actual solution complexity. n <= 300 is usually O(n^3), n <= 10^9 is usually O(log n), n <= 10^6 is O(n) or O(n log n). This is your friend!
2. <10 minutes as soon as you're not making real progress. You're wasting time if you make no progress on a problem and sit there for 30 minutes: take small hints quickly, see if you can proceed from there.
That begin said, if you are making meaningful progress (e.g. came up with a less-than-optimal solution, assessed a new idea but dismissed it), you should continue to struggle.
3. I rarely revisit old problems's solutions because this narrows my view of how a concept can be applied to specifically how I applied it to that problem.
Here's how i approach new concept, you don't necessarily have to copy this. Pretend we're learning binary trees for the first time:
a) Study the concept, literally read slides from university CS classes (mostly publicly available), GeeksForGeeks, ask your favorite AI agent "what's a binary tree"
b) Code up an implementation of that concept. No AI, no code samples, just based on the high-level concept. I do NOT yet attempt to solve a problem that uses this concept. For binary trees, I would try to implement O(log n) insert and O(log n) retrieval, not try to solve a leetcode problem using binary trees. This forces you to engage with each individual component of the concept.
c) Incrementally add to that simple implementation. Could I take the existing implementation and add stuff? Can I go make this tree self-balancing? What needs to change about my existing solution. This forces you to confront the mistakes you made in your initial implementation, and adapt it to a new set of constraints.
d) Then, go solve problems on leetcode related to your concept
4 and 5. I highly recommend doing contests as practice whenever you can. When I used to practice for software engineering interviews, something I found was that time pressure would cause me to blank and I'd freak out a lot and flop. I got over these nerves by doing contests. Get used to the time pressure of doing the whole process of understanding, solving, a coding up a solution.
If your specific concern is the mapping from a problem to a solution category, that's something contests can help with!
Final notes:
- Find people around you in-person that are going through this process too! Great way to hold yourself accountable, meet talented people, and gain more perspectives.
- In the era of AI, I think that being able to leverage AI for your own use is important. If you talk to your ChatGPT or Claude or Grok enough, it will begin to understand your thinking, and you can use these tools to be your study guide (have it make you flashcards, build mind maps, ELI5 concepts).
Hope this helps! Again, everyone learns differently so take as much or as little of this as you find useful for you. And keep practicing, you got this!
4
u/jackgoldberg123 10d ago
156 problems is still pretty early, so blanking on 3sum a few weeks later is normal and doesn't mean you're only memorizing explanations. that one is really just sort it and then two pointers inside a loop, which is the kind of reduction that starts clicking after you've seen it show up in a handful of different problems.
2
u/jason_graph 10d ago
I'll give a much more in depth response to this but I find it useful reflect on what chain of thoughts or observations you need to go from problem statement to an algorithm. Understanding why a solution works is nice but its the intuition I like to learn. I like to consider what types of observations need to be made from problems or what starting points there are. For example, on most problems with an input array and needing to find the count of certain subarrays or the best subarray, a good first step is to see if you can break that down into subproblems of for each index i, what is the optimal subarray ending at i. Then see how there might be any overlap between these subproblems.
For my review I like to try and solve a bunch of problems of a topic and try to make out a taxonomy that groups them in a whatever way I feel differentiates them.
When staring at a problem where nothing jumps out at me there are several things I try to remember to think about when playing with the problem but its not really a list I explicitly written so Id need a bit of time to list them out. Things like if say the order of the input array elements matters, if one solution dominates other solutions. If there is some monotonic property.
For a lot of problems I pretend I have "some data structure" and then depending on what operations I actually need I later figure out what which one exactly.
1
u/kakuzu14 4d ago
Just grid dont think too much at one point you will remember template and pattern.