I’ve been participating in CodeChef Long Contests for quite some time and love solving problems there. One of the key learnings after a contest is over is reading the editorials and writing code for problems which I was unable to solve during the contest.
I’ve noticed that although the quality of editorials is good most of the time, the code for hard problems could easily exceed 200 lines with not so intuitive variable/function names in the problem setter’s and tester’s solution. Case in point are these two solutions:
It’ll be great if the problem setters and testers added a well placed comment or two in the code around every important logic decision made, which will greatly help in understanding code of seemingly complex solutions. I’ve observed TopCoder and HackerRank editorials do this and I personally feel that it expedites the learning process of readers.
Moreover, those who are not so comfortable in the language chosen for writing the editorial solution will also be able to understand and quickly comprehend the code after reading the comments in the source code.
It’s a request to the admins to ensure that in future editorials, problem setters and testers solutions contain well placed comments explaining all the major logical decisions being made in the code.