I think code review is about making constructive comments and recommendations about the posted code.
Providing example code or suggesting alternative implementations should be optional.
Questions asking for code are walking a fine line,
bordering on GIMME THE CODEZ style.
By the very nature of "code review",
the poster should bring the code, not the reviewer.
In the spirit of DRY-ing up,
an answer could include suggestions of specific techniques, such as:
- Extract repeated pieces of code to a helper method
- Extract repeated magic values to constants
- Extract varying elements to a table, and use that table to determine the path of execution
- Other ideas
Answers may optionally include example code that might help the OP,
but this should not be a requirement,
and I dislike when an OP asks specifically for code.
The first two techniques above are quite trivial to execute.
Questions that ask to provide code for such treatment typically haven't done their homework, and effectively fall in the GIMME THE CODEZ category.
I downvote + vote to close those.