Of course if a course involves game-playing with (conceivably artificial) rules, ask the rule-maker about the rules.
On the other hand, many of us are aware of the existence of the internet, and its useful-though-inevitably-compromised information.
So, to my mind, it is not reasonable to tell people that they "cannot look on the internet". It's analogous to telling people they cannot go look in the library (loooong ago...).
Even long ago, the fact that many "exercises" had become completely standard, and were often proven in textbooks, suggests to me that to try to compel novices to pretend that the "model" solutions do not exist is perverse.
Thus, we come to the genuinely subtle point: since all the exercises are done and known on the internet, what should be studied? Well... I'd claim that for people looking forward to genuine mathematics (as opposed to people fulfilling requirements), the point is internalization. That is, not just "can you walk and chew gum at the same time" _in_principle_, but, ... in practice.
That is, the low friction for (not-necessarily-high-quality) information's travel is very low... and it is (in my opinion) silly to pretend that we/students should pretend things... but/and if/when people have a timed, closed-book exam to explain various things... it is infinitely better to merely be "remembering", than "problem-solving/thinking".
Yes, I do agree that it is non-trivial to convey the issue, much less convince, ... but I do think that the salient point is less simple than in the past, and some variants of the "compulsion to do " are indeed no more than filters for some other path. Which is demeaning both to mathematics and to the person... but, nevermind.
Back to the literal question: it is good to think about things oneself, and it is good to take the trouble to discover that (many) other people have thought about things before, and to learn from their travails, and ... Duh.
My most pointed comment here would be that many of the traditional mythologies of mathematics and other academic versions of things implicitly deny, or disregard, the palpable fact that most thoughts that occur to us are not at all new. The "external funding" or other administrative strictures seem ... to compel us to declare belief in a "Whig" version of history, in which everything else was just a prelude to our own ... special uniqueness. :)
In fact, very many ideas that occur to us have occured to the minds of many people before, especially in the last 230 years or so, as an approximation to "modern times". There is that ol' mythology that seems to tell us that we must/can transcend all the things that long-ago people did. But this is simply unreasonable, since we have scant advantage... apart from the accumulated scholarship, for those who track it.
So, again, ask what your "rules" are, but/and realize that it is best to learn from the hard-won (by "suffering") experiences of others, rather than repeating the same suffering.