Recently we got the question Finding the longest word in a String. (10k required)

This question looked like it was off-topic, because of the following results:

>>> findLongestWordLength("What is the space?");
>>> findLongestWordLength('What is')

If 'word' means any segment that isn't a space then it's correct. The second is flat out wrong. However the code works correctly, to the best of the author's knowledge:

I just passed the test in freecodecamp with this code and I don't know if stackexchange has some other tests – OP

I tracked down the challenge and found the code they posted here passes all the tests on the site.

In this rather strange situation, should the question be off-topic?

  • \$\begingroup\$ That's the question where the specification was more borked than the code, right? Quite an unfortunate incident. By the letter of the law it would be on-topic, but it simply doesn't make sense to review it. \$\endgroup\$
    – Mast Mod
    Aug 10, 2018 at 5:36
  • \$\begingroup\$ @Mast Yeah the one that some of us had a short chat in chat and on the question about how it didn't pass our tests. Why wouldn't it make sense to review it? Pointing at the bugs could lead to a multi-question review. \$\endgroup\$
    – Peilonrayz Mod
    Aug 10, 2018 at 8:48
  • \$\begingroup\$ The comments already pointed out the question makes no sense and that the code is technically correct. There's no pointing out bugs if the specification is bogus and improve code that makes no sense to code which still makes no sense is a waste of effort. \$\endgroup\$
    – Mast Mod
    Aug 10, 2018 at 8:52

1 Answer 1


The code is "obviously" borked.... and has a completely illogical test condition: If the word is longer than its position in the sentence, then it is the longest word.

Having said that, as you point out, it's apparent that it passes the online test cases.

However, the comments immediately pointed out the basic problem, and subsequently the comment discussions listed additional (though not as severe) problems.

With those comments in place, it makes sense for the question to be closed as not-working. The user has the option of fixing those basic issues and asking for a review again. Essentially, now the user knows their code does not work. Recent examples of this happening are comments such as:

So, I am happy for the question to be closed as off-topic since, now, the user knows it's broken, and that knowledge came through a comment. The close-votes are logical.

What's odd is that the user then elected to delete their whole account (and the question was deleted with their account).

Given that, it makes no sense, in this instance, to do anything other than leave the question the way it is, closed, and deleted.

In general, if a question is posted with issues that are obvious to our community (even if not obvious to the asker), comments, and close-votes are an indication that the asker should review those basic issues and edit their question. Obviously, if there's answers already, then their question should be unchanged and a follow-up review considered instead.

  • 1
    \$\begingroup\$ In the past we haven't closed things when the OP hasn't know there is an error at posting, and gets told in a comment. Why should we start doing this now? \$\endgroup\$
    – Peilonrayz Mod
    Aug 9, 2018 at 15:59
  • \$\begingroup\$ @Peilonrayz - it happens "all the time" .... let me find some examples - I scanned the last couple of day's worth of closed questions for those that the user thought was working, but issues were pointed out in comments. I added them as items in this answer. Those users can now go back and fix their code to reopen, etc. \$\endgroup\$
    – rolfl
    Aug 9, 2018 at 20:14
  • \$\begingroup\$ "Confusion about Java object types" is a question asking about explanations about the code, not about a review. So unless the intent of the author changes, the question can't be fixed. It's a request for something we don't do. \$\endgroup\$
    – Mast Mod
    Aug 10, 2018 at 5:40
  • \$\begingroup\$ Your two questions are nothing like this situation. One is broken and the op knows, the second doesn't compile. \$\endgroup\$
    – Peilonrayz Mod
    Aug 10, 2018 at 6:57

You must log in to answer this question.

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