Your brain continues to solve problems even when you are not thinking about them.
If you are stuck get up, get away from the problem. Do something else.
I recently hit a challenge. I was stuck.
Old me would have poured HOURS at the problem.
New me put in 20 minutes first thing for a couple of days. If I didn’t have a good solution or idea, I went on to something else that day.
Yesterday when I sat down at the computer I had a solution. It took me 15 minutes total.
The only thing that changed is I gave myself (brain) the space to solve the problem.