It is our general understanding that when we want to solve a difficult problem, we must think over it consistently to get a solution. This general understanding can be true, and it can solve many problems, but this is not the only way.
Solving a problem through dreams
Yes, as strange as it sounds like, it is known to be true. Study suggests that during sleep, the parts of brain related to visual imagery are more active than in an awake state. While parts related to abstract thinking, planning and censorship are less active. Which is why lesser cultural and sexual censorship is observed during dreams, and the conventional way of solving problems is not followed by the mind. Thus, our mind can think with a different perspective over a certain problem.
“Dreams are highly visual and often illogical in nature, which makes them ripe for the type of "out-of-the-box" thinking that some problem-solving requires." , says Deirdre Barrett, a psychologist at Harvard University.
Deirdre Barrett conducted a study involving 76 students. These students chose a problem from their own lives to solve in their dreams, and these problems could include homework or any other problem depending on the student. Students focused on the chosen problem before going to sleep, they did this for one week continuously. After a week results showed that half of students dreamt about their problem, and quarter of them dreamt the solution to their problems. This confirms the hypothesis, that it is possible to solve a problem during a dream.
Many renowned men have reported to get their creative ideas and discoveries during a dream. Chemist kukule reported that he proposed the structure of benzene in a dream, for which he got Nobel Prize. Mendeleev reported to propose the idea of complete version of periodic table through a dream. Many other poets like Coleridge, novelists like Robert Lewis Stevenson, and inventors like Elias Howe's (who invented sewing machine needle) were also reported to acquire their ideas from their dreams.
Solving a problem with the help of unconscious mind
Another way of solving a difficult problem is to simply stop thinking about it. Developments in neuroscience suggest that our unconscious mind is capable of decision-making, evaluating and problem solving. This undoubtedly explains how this rather lazy way of solving problems works. When we think about a certain problem over and over and then stop thinking about it, we actually give this task of solving the unsolved problem to our unconscious mind. So there you are, doing your chores or going through your daily life, and your mind is trying to solve the problem for you. And you are totally unaware of it, and then suddenly the solution comes out of nowhere into the field of your consciousness. Well, in fact, not from nowhere but from your unconscious mind.
A great philosopher, logician, and mathematician of 19th century, Bertrand Russell also mentioned this way of solving problems by saying:
“I have found…that, if I have to write upon some rather difficult topic, the best plan is to think about it with very great intensity—the greatest intensity of which I am capable—for a few hours or days, and at the end of that time give orders, so to speak, that the work is to proceed underground. After some months I return consciously to the topic and find that the work has been done."