# Is proposing an alternative approach instead of code improvements a valid answer? [duplicate]

I remember seeing a question which caused me to ask myself: "Why even bother writing all that code if XYZ would reliably solve that problem in a few lines?"

Would it be a relevant answer if I proposed the XYZ-based approach?

In my mind, the answer to this question depends on many things:

• If the question is a puzzle/contest problem/programming exercise, it is okay to provide an alternative within the context of that problem becase that's the whole point of the question. Say, commenting on a better way to select a pivot in quicksort question is fine. Proposing to use a mergesort in the same question is probably not a good idea.
• If the question is in the realms of real project/production code AND the assessment criteria are NOT provided, proposing an alternative seems to be a nice things to do because this may lead to quality/cost effects that affect end-users in real life.

Am I thinking in the right direction?