I am struggling DSA solver, and I understand the pain of DSA, so frustrating. But of late, I have started to get a hang of it gradually. So I thought to jot down what steps I follow, just in case it helps someone:-
Step 1. Try for 15-30 mins, user pen-paper if some ideas are coming to mind. It really helps some time.
Step 2. If stuck after 15-30 mins, take a break, and take another attempt for 10 mins.
Step 3. If still not getting any idea, look at the hints given.
Step 4. If that too doesn’t help, read the comments on the problem (not the solution), sometimes in comments, some folks have given step by step instructions to solve it, or some more clear hint about solution.
Step 5. If reading comments too doesn’t help, then read the solution. Read and try to understand the top 3 solution and also the comments made under it. Sometime the top solution is difficult to understand, so other solutions, or comments help.
Step 6. Most frustrating is, when even after reading the solution, you don’t get a clue, and frustrating because by now, you may have spent hours in the problem (with gaps of course). So then, what I do is, I copy the solution, and run it in my local IDE, with debug turned on for every key step, and I try to understand what is happening at that point. That really, really helps. Sometimes, the written words may not make much sense, but running it in IDE with debug on, and analysing the data flow, really makes things clear.
Step 7. Once you understand using above step, don’t copy-paste the solution as your solution, but rather than that, now, do the same solution in your IDE, but without looking at the solution now. Look at the solution only if you get stuck at specific line while writing, or while running the code.
I think this step 7 is really nice, i.e. when you understand the solution by copying and running, but then you do it yourself once again, without looking at the solution. I just solved a Hard problem using this way.
Step 8. Even now, if nothing makes sense, which certainly may happen, I fear there is no other way than to move on to other problems. OR, one alternate way could be to watch the video explanation of the solution (which I don’t follow till now, not much patience with video at least as of now)
My stats: About 70 problems in LC, and most of those- about 50- are easy ones done long back.