Performance problems are common in code presented in Code Review. The most valued reviews often point out ways to be more efficient.
Time limit exceeded (TLE) problems are performance problems where the performance is poor enough to cause an online judge to 'fail' the solution. Does the code produce the right result? Probably. Does it produce it in the right amount of time? No.
There are a few perspectives to have when looking at these problems:
Many of these judging systems are designed as tools to aid learning. Does posting a question to Code Review reduce the learning value of the question? No, and this is why:
- a person whose code is failing the performance aspect of an online judge is not learning anything anyway. All they know is that there must be a better way, but the tool does not say what that way would be. They need some outside intervention to provide the key knowledge for producing a better solution.
- the alternative to Code Review would be a Google search, and a 'get lucky'. This would teach them less than a code review would, because it does not explain why their code is slow, instead it just is a cheat for them anyway
At a point of crisis in the development of an algorithm, the right solution is to get a helpful hand and redirect, and an "education".
You have a valid concern when you say: "While I enjoy reviewing the algorithms, I can't help but to feel that sometimes the poster might only be interested in getting their score on whatever programming challenge site it is and simply uses this site to "cheat" and get the correct algorithm."
I think this does happen, but this is not really a problem we should concern ourselves with too much. The only person who suffers here is the person asking the question with a 'cheat' in mind. Our answers here are just one of many places where the person could find the answers. Sure, our answers here will be another place where other cheaters can find the results, but, it is one of many, and only the cheaters lose value. The people who have tried hard, and are struggling to find the right algorithm, and are looking for that next pointer, those are the ones with the most to gain from a review.
Additionally, the person suffering a TLE problem are not likely going to be able to simply reinvent the right algorithm. They have to get it from somewhere. Sure, a good Code Review answer will point out the right algorithm, it does not mean it has to write the whole program as well. Pointing out the right algorithm would be a useful part of a review. Only write out the full working solution if it is something that makes the review easy, or is something fun that you want to do anyway.
You say: "it doesn't provide any answer and thus doesn't work" and I counter that with no, the online judge failed to let it run long enough to produce the right answer.
I think there are a number of ways to look at this type of problem. On the one hand, the code fails the online judge, and that is the code's purpose, so the code just fails, and thus would be off-topic.
On the other hand, the code also works for the person who runs the code (just not for the judge). It works for them, and produces the right result for their input. They want it happening faster though. Still, to the best of their knowledge, it (will) work, if given the opportunity.
You are correct that the solution to these TLE problems is typically a complete rewrite of the core algorithm. The need to move from an 'obvious' implementation to a more obscure, technical, or mathematical approach.
Just because the code needs a rewrite does not mean that it is not ready for a review. It also does not mean you have to rewrite it. In many cases, a high-level review and a pointer to the right algorithm would be excellent feedback to the asker. An explanation of why their algorithm is slow is what they need, and a meaningful pointer to what the right solution is, would be much more of a learning experience than anything else available.
I believe these problems are just a special kind of performance problem, a problem where there's an objective 'judge' which fails code beyond a threshold.
The code is functional, and produces the right results (slowly).
The askers are normally quite frustrated when they ask, and need an insightful 'redirect' in a gentle way. Code Review is a good place for that.
Often the problems are interesting, and fun to work with.
You don't have to answer them all, just the ones that appeal to you, and maybe there's someone who finds this question appealing in turn.
Remember, Code Review should be a place that is fun to review things on too. If it does not look like fun, then don't do it.