Applying the homework tag or asking a whether a question is homework can result in some hurt feelings. I was thinking it may be helpful to document some of the characteristics of questions that lead some to conclude that a question is homework, so others can avoid them.
The question includes some arbitrary constraints that are unlikely to be present in a real-world problem. For example, the question declares that certain features of a programming language are out-of-bounds despite being well-known, widely-available, and/or the trivial way to solve the problem.
Imperative Sentences And Tone
The general tone of Stack Overflow questions is that of someone asking for help from a colleague. Homework assignments tend to include imperative statements demanding some feature of the work. "Your solution must execute in O(n) time" sounds like a homework assignment. "I need to get this to run in linear time." sounds more like a question, and is less likely to be deemed homework.
It is rare for a real-world programmer to face problems like creating a class hierarchy for the animal kingdom or creating a common data structure from scratch (though this would be a valid form of self-study). Most developers were once students themselves; some have even taught classes, and there is a limited menu of standard assignments, which we will generally recognize.
How often do you need to implement quicksort or linked lists from scratch? Most languages offer standard implementations of standard algorithms and structures. Implementing such things yourself is a fine way to learn how they work, and so they're often assigned as homework problems. In the real world, we don't write such code ourselves very often.