Sometimes, when looking at other people's golfing attempts, you see a trick that will improve your own one, or you might see a glaring improvement that is not entirely obvious to OP. For instance, in this code-golf the slightly glaring improvement is to make n an int instead of a string, yielding:

print n

Which is 7 characters shorter.

How should this be handled, because in the above case I'm clearly spring boarding from another's work, but if I only give a comment I will not get reputation (comments upvotes don't get reputation AFAIK). On the other hand, posting it as my own solution feels too much like stealing. What should the policy on this be? Because I think this type of thing will happen often.

  • 1
    \$\begingroup\$ I am the OP of the answer. Since the solution was easy to come up with I welcome everybody to improve it and repost it. \$\endgroup\$
    – Alexandru
    Commented Jan 29, 2011 at 3:46

3 Answers 3


Small improvements like this one should either be suggested by leaving a comment like you did or by editing in your improvement. If the OP doesn't agree with your edit, he/she can rollback. Note that even low rep users can now suggest edits. We should consider reducing the minimum edit length requirements for edit suggestions.

Larger improvements where you're putting in considerably effort can be a new answer, but please cite the original answer which you built yours from.

  • \$\begingroup\$ This is an old answer, so I should clarify to anyone who finds this thread more recently; editing someone else's answer to golf it is no longer recommended on PPCG. It's best to go via the comments. \$\endgroup\$
    – user62131
    Commented Jan 5, 2017 at 8:42

If I copy the code into my editor and change it round a bit, I credit the author of the original idea.

If it is too similar, I'll probably just post a comment, but if it takes a significant effort to shave a few bytes, I think it's fair enough to throw it up and see if it earns a few votes.

I also credit the author if I turn their Ruby idea into a Python answer.

I'm also happy for people to base their answers on my own, but it is nice to see some acknowledgement.

Ultimately it's up to the voters to do what they think is fair, if there are two almost identical answers.


I think people have an intrinsic sense of right and wrong and will down vote golfing attempts that are clear copy and modify slightly. However, I think people should have something to motivate them to do the right thing. A potential solution could be to make comment up votes give reputation if they are comments on answers in questions with the code-golf tag.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .