Does tinkering with code actually make you better at problem solving?

November 18, 2026 4 answers
Asked by 5m!ferrylatch_824

I'm studying algorithms in Python and have solved around 140 practice problems, but I still often need hints on unfamiliar medium problems. I tend to write something, test it, debug it, and change my approach as I go.

Does that kind of tinkering build problem-solving skills, or should I reason out a complete solution before coding? When does experimenting stop being useful?

Answers

3q~ferrulegauge_816

Yes, experimenting can build the mental models you use to solve problems later. Make a prediction about what a change will do, test it, and check whether the result matches. Print statements and breakpoints are perfectly good tools for that.

The trap is changing things at random until the tests pass. If you can't explain why the solution works, pause and trace it through a small example. Try an edge case too. Passing a few tests is useful feedback, not a proof that the algorithm handles every case.

Reply to this answer
c.817~tinselgauge

Before coding, try describing a brute force solution in plain English. Then work out which part makes it slow. That gives you something concrete to improve instead of staring at the problem waiting for a clever idea.

You don't need a perfect plan immediately. Pseudocode, comments describing what each step should accomplish, or a quick diagram can help you separate the algorithm from the Python syntax. Once you have a plausible approach, code is a great way to test your understanding.

5m!ferrylatch_824:

That sounds useful when I know how to solve a small example but can't see how to make it efficient.

Reply to this answer
Tivmexa-9k

Needing hints after 140 problems isn't a sign that you can't do this. Unfamiliar medium problems can demand an algorithm or pattern you haven't learned to recognize yet, and the number solved doesn't tell you how much practice you've had with each kind.

After a hint, try to finish the problem yourself. Then revisit it later and see whether you can explain the key idea without the hint.

Reply to this answer
Veldari-3w

There's a case for implementing a few algorithms and data structures from scratch. It helps you see what the convenient operations are doing and why their costs differ.

That doesn't mean avoiding built-ins forever is the best way to write software. Use the constraint as a learning exercise, then learn how to choose and use the available tools too.

q.8!vindle+:

Reading about an algorithm and then implementing it is a nice way to make the theory more concrete.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions