KazmetreD's blog

By KazmetreD, 3 years ago, In English

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.

  • Vote: I like it
  • +75
  • Vote: I do not like it

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

I'll just leave this link here: Best practices for writing code comments

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

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

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

It will be helpful if each and every explanation of questions can be divide to two parts

Implemenation and Algorithms

Algorithms
Implementation
»
3 years ago, # |
  Vote: I like it -8 Vote: I do not like it

maybe pseudocode would be nice, and comments will only be for shortcuts and tricks