This is not a technical question, but rather a social and methodical one. I am a computer sciences student and I usually have really tough programming assignments. I don`t know if it is only happening to me but sometimes, particularly when deadline is approaching, i find myself in a harsh situation. I cannot find my mistake in the code or come up with a another great idea. Then boredom comes in and the problem begins to seem unsolvable.
I know there are more-than-great professional coders here. I would like to learn their ideas to cope with this situation. Is it better to focus on something else for a while and try again or try harder and harder and look for the solution on the net etc...