Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Recently, I have been trying to learn programming and improve my ability in writing method level code through practices on websites such as Codingbat.com

However in the recent weeks I have been stuck for weeks at the last 2-3 questions of String-2/Array-2 and early String/Array-3 problems. It feels really tempting for me to give up and google online for the solutions, but I'm afraid that by doing so I may end up not improving my ability at all.

I wonder if this is common and when faced with such situations how long do 1 wait before giving up to look at the solutions or to continue spending more weeks on trying to solve the problems by yourself? How do 1 really engage in effective deliberate practice to improve programming ability and attain the necessary problem solving techniques? Any formal techniques available to tackle the never seen before problems?

share|improve this question

closed as not constructive by gnat, Walter, GlenH7, Robert Harvey, Thomas Owens Nov 24 '12 at 11:46

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

3 Answers

Basically, the key is to make sure that you're learning something and that you don't ever stop learning. If you're beating your head on a problem to the point where you are legitimately stuck, and you've stopped to take a break for awhile to let your subconscious chew on the problem, then you've come back and spent more time and are still getting nowhere, then you've stopped learning.

At that point, do some research and Google the problem. As @Omega says, don't just take the answer and copy it verbatim, make sure you now use this as an opportunity to restart the learning process. Understand why the solution works. The benefit here is that eventually you'll run into a completely different problem that somehow utilizes some of the knowledge you gained from this experience, not to mention the problem solving skills you gain from the technique of always trying to solve it yourself, taking the mental break, then coming back and doing the research.

In short, as long as you're learning, that's all that really matters.

share|improve this answer

To be honest, looking at solutions shouldn't cause you any harm as long as you study the solution you just read and try to use it in the future by your own.

How long it takes before looking for a solution is a bit subjective. It really is up to you - if I get too stressed with something, I tend to just stop - no need to kill my brain. I just look at a solution and do my best to understand why is that actually the solution instead.

Sometimes, when you finally know how is something done, you're probably going to find other ways to achieve the same effect by your own since you now have a better idea of the problem. So if you read a solution, try to implement something different by yourself afterwards.

Seeking solutions is not a problem at all. To stick with them without exploring further is.

share|improve this answer

That is up to you, cos I can see at last two possible edge cases:

A. You want to solve the riddle and do it all by yourself to get an understanding of it from basics

B. You want to be practical and get the problem solved using all the possibilities you have (wiki, google, wolfram, SO and etc)

It is up to you where you draw that border you don't want to cross. Quick example: Write code to solve TravelingSalesman problem.

A. You invent your own code (possibly just checking ALL combinations);

B. You Google for Wiki article explaining common approaches and write your own code;

C. You Google for code implementations and learn from them, without direct copy-paste;

D. You Google for code implementations and adapt them to exact case you have.

Each of the approaches gets the problem solved and each teaches you something (thinking or searching in different proportions).

P.S. There's alternative N, where you hack the site to give you max points :)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.