I'm practicing data structures and algorithms, especially sliding-window problems, but I sometimes spend two or three hours trying to find a solution. How can I tell whether I'm making useful progress or just going in circles? When should I use a hint or read the solution, and how can I make sure I actually learn from it instead of simply copying the answer?
2 Answers
If you have a deadline, look up the solution sooner so you don’t lose the entire study session. For pure practice, spend some time exploring first, then use the smallest amount of help needed—a hint, a diagram, or the core idea. Immediately copying a complete solution may produce working code, but it usually teaches less than reconstructing it yourself.
Looking at a solution can be part of learning, but don’t stop at reading it. Study the key idea, identify the clue that reveals the pattern, close the explanation, and recreate the algorithm yourself. It’s also useful to revisit the problem later and solve it again without assistance. Over time, repeated exposure to patterns such as sliding windows will make similar problems much faster.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically