KazmetreD's blog

By KazmetreD, 7 weeks ago,

Sometimes when I read "Tutorial" section for a problem, I get what it says but I can't code it. So I look at "Solution" section and try to understand. Then I realized that, it would be much better if there was some comment lines to explain how that code works.

Let me give an example:

Example

This is too easy and detailed. But you got what I want to say.

• +75

 » 7 weeks ago, # |   +19 I'll just leave this link here: Best practices for writing code comments
 » 7 weeks ago, # |   +8 I agree that comments may sometimes help you understand the code better. However, when I don't understand something in the editorial code it mostly comes from the difference in coding style, not the absence of comments. Understandably, this is to be expected, as the code in editorials is written by different problemsetters and testers.To that matter, I would suggest reading not only the editorial code but also the submissions of other higher-rated people. Eventually, you are likely to find multiple smart people whose coding style is similar to yours and understand their code easier than the one in an editorial. Hope this helps :3
 » 7 weeks ago, # |   +1 It will be helpful if each and every explanation of questions can be divide to two parts Implemenation and Algorithms AlgorithmsIt can have the intution/approach/key observation with explanation of a test case. ImplementationIt can consist of pointwise like step by step process of writing code.
 » 7 weeks ago, # |   -8 maybe pseudocode would be nice, and comments will only be for shortcuts and tricks
 » 7 weeks ago, # |   0 Hello Mr. high school teacher
 » 7 weeks ago, # |   0 Sometimes I don't understand the editorials itself