Struggle is good, but not too much of it.
As a general rule, if you cannot solve a problem within 20 minutes, then stop and talk to somebody about it.