I'm learning programming and I'm now at an advanced stage meaning that I need to solve problems from fields such as dynamic programming, path finding or recursion problems. Depending on the problem I need anywhere from multiple hours to weeks to solve a problem. I often get stuck which seems to be normal from what I have read so far. However sometimes I got stuck and did not code for weeks and then finally was able to solve the problem, even when not thinking about it. I just looked at it from a different angle and was able to solve it. The question is: If I am really stuck, so that I do not code for days to weeks, should I start another problem or should I insist on finding the solution to the problem I'm stuck with. Is there any research pertaining this phenomena?
Interesting queston I am a psychology student who is learning how to code as well. I am often thinking about what are the best strategies to learn. Below I am referencing a research paper that showed that a too rigid mindset impairs performance in general problem solving abilities.
ErEl, H., & Meiran, N. (2017). A drop in performance on a fluid intelligence test due to instructed-rule mindset. Psychological Research, 81(5), 901–909. https://doi.org/10.1007/s00426-016-0796-8
I am found something similar in my attempts to learn. Sometimes it is useful to take a break to relax your mindset, as it seems that the mind inhibits other solutions, when you are focused on something to exclusively.