As we all know that a lot of homework questions are posted on Stack Overflow. Few just post the question as such without even trying and few genuinely try something and post a specific problem. In the case of second scenario, we should help the OP as the OP has tried his homework and is genuinely stuck somewhere.
My question here is, to what extent are we supposed to help the OP?
Let's consider a scenario. The OP is supposed to do something with
for loops to remove duplicate elements and the OP seems to be getting an
ArrayIndexOutOfBoundsException for some reason. There is a constraint that the OP can't use
java.util classes as its not allowed. But when the OP posts a question here, there are many answers which suggest the OP to use a
Set. Agreed that using a
Set solves the problem in no time, and its the best solution for this kind of problem, but shouldn't we actually address the OPs actual problem of
ArrayIndexOutOfBoundsException and try to help fix that, instead of just asking the OP to use a
Isn't that the challenge to try to solve the problem with the given constraints in place? By removing that constraint out, we are not trying to help the OP at all. There have been so many situations where the easiest solutions are of no use, as the OP can't use them due to some constraints. What should be done in such a scenario? Just ask the OP to use a
Set and not actually help the OP fix his
Please have a look at this question which has an answer posted by me (now deleted). If you have a look at the comments section, the last comment of the downvoter was the one which prompted me to post this question. For people who can't see the deleted post, here an excerpt from that comment
If it's HW and he's not allowed to use Set - that's his problem, SO was not meant to help people with their homework.
I would love to know what others feel about this?! Because I've seen people giving different solutions to the OP, if it was a post by someone working in a project(and not a homework question), having certain constraints on the usage of certain libraries.