How to deal with math problems if there is no solution book and no helpful teachers?

frustrating to get stuck for days and knowing that a solution exists. So knowing that I miss some important way of thinking.

So your solution to missing some important way of thinking is ... to not think at all?

If you try hard to solve a problem, you are learning. You learn what doesn't work and why. That's a valuable lesson, and it's how you get better. In fact, I'd venture to say if it takes you 4 days to solve a problem, then even if you don't end up solving it, you probably learned more than the person who solved it in 1 hour.

In mathematics, knowing the exact solution of some made-up problem usually isn't the key. After all, the exercise question tells you the conclusion of the solution. You already know the result from the onset. You just have to prove it, and it is the things you learn from proving it that are important, and that's my point: even if you don't manage to prove it, you still did worked with the details and learned similar concepts to the person who did manage to prove it. You just learned it slighty differently, e.g. somebody who proved it learned "okay, this technique works in this case", while you learned "okay, this technique doesn't work in this case". Both are equally valuable.