In my opinion - a "good answer" is one that will assist future users of the site as well as the current supplicant. To this end - a specific solution to a niche problem isn't actually all that helpful.
But suggesting an approach and offering a runnable example of how that approach might work, is.
So might even downvote answers that are just a chunk of code. (Not always - I do tend to give some credit for them being 'right'). But usually will comment to suggest adding an explanation and expansion of what's going on, if it isn't self evident.
But will definitely tend to preferentially upvote the answers that contain:
- explanation of what's going on.
- why that's a good approach to take.
- What things you need to consider.
- some sample code to illustrate the point. (needs to be runnable, doesn't need to solve the whole problem).
Of course, that doesn't always apply - some answers can be answered trivially. (Although then they may also be offtopic for typographical error or similar)
TL;DR - upvote stuff that teaches, comment suggesting that would improve the answer if it's not there.