-27

Why users who can't provide a solution for a coding question can close it?

I posted a question (Most efficient way to check if Array contains more than one condition in same row) that nobody could answer, yet it was closed, not because of verbal issues or because it wasn't good enough, it was closed just because it needs to be focused, yet no one gave me a usable answer!

3
  • Nope, because what i'm seeking here is why my question closed and it didn't violate any s.o. rules, just because it needed to be "focused !"
    – AhmadMM
    Commented Jan 22, 2020 at 12:23
  • 11
    That it needs to be "focused" is a site rule.
    – yivi
    Commented Jan 22, 2020 at 12:24
  • Yeah, i know but the problem that my question didn't actually violate any of the rules "focused" rule was made for
    – AhmadMM
    Commented Jan 22, 2020 at 12:27

2 Answers 2

30

Because questions asking for "the most efficient way" rub people the wrong way. But that's not all.

If you have a collection, and you want to check if something is present in that collection, you need to iterate over that collection. So your "without loops" constraint, added later in comments, rubbed people even more in the wrong way. But that still is not all.

If you could instead explain why this is a real problem (do you have an array containing hundreds of thousands of items, or is the product of the needles and haystack in that order of magnitude), does using the code you have on your website incur a measurable performance problem?

Then mention that performance problem, and show what you have tried to mitigate it. Have you looked at other collection types, like a hashmap? This has an insertion penalty compared to arrays, but has way faster lookup than simply iterating.

And so on. So no, it's not "users who can't provide a solution" who close your question. It's users who think it can't be answered in its current form, and the fact that you claim the two great answers you received aren't usable, confirms that. You just want people to throw suggestions your way until you find one that sticks, and that's not how this works.

4
  • I fully understand what you're saying, but the closed flag couldn't help me with my question nor for whom will come later on searching for such answer for such case, maybe we need to face the fact that discussions aren't welcomed in questions, your answer would have helped a lot of people to reconsider the way to programmatically solve my problem, yet i found a way to solve it,but now unfortunately i can't share it anymore because of the closed flag
    – AhmadMM
    Commented Jan 22, 2020 at 12:04
  • 7
    @AhmadMM "we need to face the fact that discussions aren't welcomed in questions" — Indeed, they aren't. Never were. Quite explicitly. ("This site is all about getting answers. It's not a discussion forum. There's no chit-chat.")
    – deceze Mod
    Commented Jan 22, 2020 at 14:30
  • @deceze Shouldn't developers discuss problems in order to reach a suitable answers ?
    – AhmadMM
    Commented Jan 22, 2020 at 14:43
  • 12
    @AhmadMM Not here. No. The site is Q&A and Q&A only.
    – Dan Bron
    Commented Jan 22, 2020 at 14:45
13

yet no one gave me a usable answer

How can somebody give you a usable answer? We don't know what's "best". Not for you, at least. Is it:

  • fastest runtime?
  • lowest time complexity?
  • lowest worst-case runtime?
  • lowest amount of lines in a solution?
  • lowest amount of bytes in a solution?
  • most maintainable?
  • least error prone for the future?
  • most idiomatic?
  • the most creative use of tools in the language?
  • anything else?

These don't exactly overlap and some are at odds with one another. "Best" is very subjective and very context-sensitive, so asking for "how to best do X" is meaningless without knowing what properties of a solution are you looking for.

Another very important question to ask is why you want the "best" (given sufficient parameters for what constitutes that term) solution. Beware the XY problem. Very often I've seen people ask for "best" as "fastest runtime"...for a problem that doesn't benefit from optimisation as it's not a bottleneck and it's not going to be. So, maybe you want the "best" but there is no need for "the best".

2
  • The question was clear about "usable question", that i meant without using iteration, fastest way possible
    – AhmadMM
    Commented Jan 22, 2020 at 12:21
  • 18
    I don't think that meaning is clear from the question. Nor do I see what necessitates the "without using iteration" restriction. Not to mention that restriction is...odd. You must check the array, so you have to iterate. If you don't, you can't check the array. The only alternative is to maintain a lookup...which then increases your space complexity. Is it "best" or "efficient" if it has a non-O(1) space complexity? Hopefully you can see how these descriptors don't actually tell us what you mean by them.
    – VLAZ
    Commented Jan 22, 2020 at 12:43

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