kevbamboo's blog

By kevbamboo, history, 2 years ago, In English

How do you learn from your mistakes? Like how do you learn from the solution? Even if I understand the solution, I am not able to generalize the answer to the one problem to others of the same type.

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

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

e.g. when I looked at a dp solution for a medium leetcode problem, I couldn't generalize to an easy problem without looking at the hints.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    Because CP isn't about generalizing it's about learning to think and problem solving.

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

      But also, like every time before I get an AC, I have to make like 5 wrong submissions, most of which are dumb mistakes. How do you prevent that?

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

Learning from your mistakes is only part of getting better. You won't be able to generalize the answer from one problem to another by only looking at your mistakes.

I'm new to this whole competitive coding thing, but it seem a lot like chess -- something I am much, much more experienced in.

Now in chess you won't get much better if you only look at the mistakes in your games -- although this is something that you need to do to improve. Looking at the mistakes helps identify the areas in which you are weak, from there you can identify what you need to improve on and then practice in that area.

Say for instance you lost a game because you missed a fork. Well, this suggests that you should brush up on this particular tactic. Now keep in mind, if you solve a chess tactic that is rated 1800 that uses a sacrifice and a fork that doesn't mean you are going to encounter that exact sacrifice and fork tactic in your future games (or ever again for that matter) nor are you necessarily rate at 1800 -- however, you are training your brain to pick up on this tactic subconsciously. You become aware of the idea that such a thing can be done. If you are new to chess it's one thing to learn what a fork is, it is then another thing to recognize it in a different situation.. how good you are is in part predicated on how well you can recognize these patterns and how fast you are at finding them.

Similarly in coding, in order to get better look at what your mistakes are. If it is DP then do problems that involve DP and then do random problems were you must realize that DP is the solution. If you are making a lot of small blunders -- silly mistakes -- then keep practicing.

Another key takeaway here when learning something new/ trying to improve is consistency -- you must consistently do problems or else you brain will forget and you lose all that practice you've done.

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

    are you from quora

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it +12 Vote: I do not like it

      No? Why is there something wrong with my advice?

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

        Just codeforces things

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it +11 Vote: I do not like it

          ... my answer is directly related to OP's question. Am I not allowed to give an analogy to help elucidate a concept?

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

            I think, a known/popular analogy would have been helpful. But in this case personally I don't know anything about chess, and I think many people would have not got anything that you have said about fork, sacrifice and all that stuff, and maybe that's why they have downvoted. :-\

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

        because your comment makes a wise and well-thought-out impression, but it consists mainly of obvious statements, and no true insight. anyone can give such "advice", even people who have never programmed.

        this is exactly what people on quora do when they see a question they can't answer but still want to say something: write a long text with 0 content that looks smart. random forced analogies are the bread and butter. only thing missing is an unrelated pic of a webcomic or hot girl

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

          No need to be so vitriolic; now, how am I forcing any analogies? Learning from your mistakes applies to many, many subjects. It seems fitting to give an analogy to help explain the concept that I am talking about, especially since chess competition and code competition share several qualities -- such as, thinking analytically and logically, studying, worrying about time limits and making the wrong decisions, practicing rudiments to build a solid knowledge foundation, an ELO type rating system, etcetera, etcetera. Secondly, I think it is worth mentioning here that things that you may find so obvious may not be so obvious to others -- they weren't obvious to me at one point in my life and I had to learn things the hard way.

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

    what is your Lichess profile?

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

        ?

        • »
          »
          »
          »
          »
          2 years ago, # ^ |
            Vote: I like it +46 Vote: I do not like it

          I (the person who is typing this comment) have found the account (a persistent, long-term identity associated with a service) associated with you (the user named TheMonsoon) on Lichess.org, a free and open source website for playing chess (an ancient board game in which pieces move around and the objective is to checkmate the king). The URL (uniform resource locator) associated with this account is https://lichess.org/@/TheMonsoon. Please note that this was a best-effort guess made by inputting your username here into the Lichess profile search and may not be 100% accurate. Thank you and have a great day.

          • »
            »
            »
            »
            »
            »
            2 years ago, # ^ |
              Vote: I like it +8 Vote: I do not like it

            No need to be patronizing. I just find it odd that you would take the time to dig up a lichess account and post in on this website.

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

    The chess analogy is kinda forced here buddy.

    #chessBrah #habitsBrah #Forever1500Crew

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it +11 Vote: I do not like it

      In what way is it forced? The principle of analyzing your mistakes and then taking that analysis and practicing to improve is the same.

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

        Nothing wrong with it, I agree with your advice and understand it. But someone who doesnt know/care about chess will not benefit much from it. Mostly the fourth paragraph doesnt look non chess folks friendly.

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

How much important is Fenwick Tree for Competitive Programming?

»
2 years ago, # |
  Vote: I like it -11 Vote: I do not like it

There is a union of humorists in the comments above

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

After getting accepted for a problem think about what cost you the most time on that problem? Is it thinking, implementation, debugging, or any other thing? Then think about how you can reduce the time. Then think about when you are thinking about the problem which path gives you no solution and how you can avoid that path. After understanding others' solutions (from the tutorial or somewhere else) think about how you can go that solution logically without guessing from reading the statement. Smooth your thought path for that problem. Note your mistakes and when you make a mistake (new or old) you can read through all of the mistakes you have done so far as punishment (don't mind, just fun).

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

Your problems might have two causes, not understanding DP or not having enough thinking ability.

If you find yourself good on problems without using DP, then i suggest you to learn more classical model of DP, and then try to solve more DP problems. Because generalizing a method is not easy before you fully understand it.

If you find yourself bad at learning in analogy, that is probably caused by insufficient thinking. Try best to make yourself totally understand the algorithm, you can write editorial after you solve a problem, or share solution with your friend. Teaching others is also a nice way to check if you have totally understand the problem or not. Meanwhile I prefer USACO/Codeforces rather than leetcode. Problems on Atcoder are also very nice but it's not good to learn a specific topic.