I can relate to that feeling. When you just figure it out, not even thinking about your problem, just doing something mundane and unrelated. But that stage of concentration and struggle is crucial. You need to care about the problem, have some investment in it.
And it's so satisfying seeing the solution work, especially if you don't know the correctness 100%.
And it's so satisfying seeing the solution work, especially if you don't know the correctness 100%.