Reading solutions step by step might be a good habit to increase the patience. By that I mean, when you struggle with a question for $30$ minutes, if you have access to a solution to that problem, you don't have to read the whole solution. For example, first you can check the first idea and after understanding it, you can simply keep struggling through that idea for another $30$ minutes maybe. If you are still not able to solve it, you can go to a further step in the solution and take it from there for another $30$ minutes, not reading the whole solution.

However, there are few things to add here. There are some problems which are hard to understand but easy to solve. For those kind of problems, the solution might be a one line proof for instance so you may ask "how can I go through the solution step by step if the solution is too short?". In these kind of cases, I would suggest trying to have a better understanding on question. This could be achieved by reading more about the topic or turning back to the points where you could not grasp the intuition. Note that this kind of "struggling" also develop some kind of patience.

Finally, there might be some questions for which you don't have an access to solution. In this case, I suggest trying to find similar problems to the one you have. Sometimes, it is more satisfying (and even harder) to adapt an existed solution of another problem to your problem, than solving the problem itself.