There’s definitely something to be said about taking a break. Recently I’d been stuck on the Tic Tac Toe project, almost to the point where I wanted to through my monitor out the window. Thankfully it didn’t come to that and I had the good sense to walk away, and forget about the coding for a while.
After a reasonable break away from the problem (I spent a few days on the CS50 course that has been widely adulated on this forum) I decided to come back and take another look at it. I printed my code off, sat down with a cup of good old English tea and systematically went through my code, and what do you know, ten minutes later I was back on the computer with a workable solution. Problem solved. Happy days.