Many times solving an issue in the code takes longer time than expected. Even after debugging the code for several hours you may not get any solution. But, taking a walk, or playing a game, and then trying to solve the problem with a different mindset and a new point of view helps in tackling the problem quickly.
It has happened with me several times. It happens regularly for most of the software engineers.
Sometimes even a small bug which took hours to debug, gets easily solved after a walk or a game.