Castling's blog

By Castling, history, 3 years ago, In English

Often I found that after I had solved problem for 1 month or even 3 days, I became not capable of solving it again. I was suggested by some really good coders to code the same problem 3 times just to remember the template of an algorithm. But my struggle is often not about the template. It's more like "I have seen this before but how did I solve it?". May I ask if it's a good strategy to always solve a problem for 2-3 times? Because, if I don't spend time on the problems I have solved before, I could solve 15%-20% more problems within the same time.

  • Vote: I like it
  • -2
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it +3 Vote: I do not like it

I solve 1 problem over and over again! How do you think i'm lgm? uwu

»
3 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

I considered it norm, when I was doing my first problems — cause I struggled with code and bugs. Now when I can code without a lot of thinking about code, problems often just sparkle like: it feels like this structure... and this... and this... It's like joy of recognition — it doesn't mean you're on right track already (or ever) or that you remember how to solve this particular problem that you've solved earlier, but you kinds know it — by similarity. Yes, I still put some interesting problems to favorites list and resolve them later. And yes, first I solved some little problem 2-3-4 times to try to do it a little different and see what changed and how it works.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Is it okay to see others code after try for 15-20 mins...bcoz sometime I m able to think but unable to code.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it -6 Vote: I do not like it

      Yes, and it's ok to try to solve this problem again in 2-3 days when others code will be washed away from your short-memory.

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

I think the main thing is to not forget about not to solve problems. If you forget a key part of logic that is common to a lot of problems all of the time you will have trouble focusing on more important things while solving them.

It doesn't matter if you do that by revisiting the same problem or similar problems or writing down your thought process but the important thing is finding your way to remember things. It's super super common to read a problem and go "oh yeah, this is like this other thing but with that difference" and you solve it immediatly.

I personally tend to write hard problems down and when there's a challenging contest i read all the problems afterwards and go through what my thought process and solution were, but you see what works for you.

»
3 years ago, # |
  Vote: I like it +6 Vote: I do not like it

I would advise against it currently. At your level, all ideas are fairly common and you will see similar tricks in different tasks. It is more important to get breadth of knowledge, and after seeing an idea in the third task you will surely remember it.

Once you get to a higher level (CM/M), I can see it as beneficial in particular cases where you believe the idea is useful and you haven't seen it anywhere else (I have returned to some JOI tasks multiple times over the years).

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Based on what I did over the past few months, I really don't think there is any benefit to re-solving problems unless you encounter a very unique, but yet somehow universal idea/algorithm. Most of the ideas/algorithms, such as binary search or two pointers (and many more), that are required to solve a specific problem are reused in many other problems. Of course, it would be wise to repeat a problem if you do not remember the templates revolving around a certain algorithm, but as you have mentioned, that is not the case. It is probably a better idea to solve more problems of that kind you are struggling with, rather than solving the same problem few times as long as you already know the basics and implementation details of such algorithm/idea.