Take the 2-minute tour ×
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.

Ok, so here is my problem:

I work for a big company, some how landed a job (frankly because the interview was easy). It's not that I don't know my stuff, I am pretty good at understanding java, it's libraries etc.

But, when ever I try to solve some logic problem, I find it really hard to come up with a solution.

For example, conversion of decimal to roman, when I saw the solution, I find that it's a simple problem. But I was not able to implement it after 1-2hrs of trying out!

I feel I am dumb and not worth being a software engineer. Puzzle solving abilities should come natively to a great programer. But when I try to solve some puzzles, I am not able to find a solution and I just google it up!....and I hate that!

When given a problem (like implement xyz feature) at work, I am fairly pretty quick at it and am respect at my work place for that, but I am not at all proud about it. Because when I try to solve any mathematically or logic wise challenging problem, I fumble. I still feel I love what I am doing (as an engineer) but feel really sad that I am not able to solve some tough logic problems which I friends come up with.

I feel demoralized :(

TL;DR: I understand stuff from a practical viewpoint (implementing features in our product) but when trying to work on problem from say ProjectEuler, I SUCK badly! And I need to Sharpen my brain!

So, my questions are:

  1. How should I go about fixing it? Should I start with solving (and forcing my self to) project euler problems? Even if it takes hours for me to solve some basic problems?
  2. Or should I go back to basics and study some basic math?
  3. I don't really find puzzle solving fun. But I want to make it fun for my self! And I think if I understand them in a better manner, I will like it!

PS: I was never educated in CS (my undergrad was electrial). But that's not an excuse to be a sucky developer.

Thanks!

share|improve this question
3  
If it ain't fun solving puzzle for you then why bother ! –  V4Vendetta Oct 20 '11 at 6:23
3  
Its not fun because I have tough time solving it. If I get good at it, I am sure I will like it! –  John Oct 20 '11 at 6:27
1  
You could always try this (warning, SERIOUSLY addictive if you are into puzzle solving) –  Benjol Oct 20 '11 at 7:55
2  
Nothing comes natively. Even the most basic skills needs learning. I'd recommend calculus and classical mechanics as playgrounds for training the required abilities, but many other subjects (including entirely non-mathematical) could do the same. –  SK-logic Oct 20 '11 at 9:12
3  
@John Confirmed. It was a difficult problem. You shouldn't feel bad if you can't solve it in 5 minutes. One and half hour to do it, after reading the Wiki about roman numerals, and only by comparing its results with the results of another implementation I was able to correct a bug. I (like many others) thought that IL was a valid number. Wrong. XXXIX is the right number. Plus I had to watch other implementations to optimize it (I was pre-caching II, III, XX, XXX and so on but it's useless). Don't feel bad! –  xanatos Oct 20 '11 at 14:34

7 Answers 7

up vote 22 down vote accepted

First, it's wonderful that you see this as a weakness in your skills. You actually know where you need to improve, which makes for a far easier time doing so, and indicates that you are better than you think.

I believe your primary problem, which I've seen many times before, is that you don't have a "problem solving toolset". When faced with a problem, what do you do? How do you go about solving it? I'm slow at math, but because I know how to use the little tools of math together, I aced calculus.

So, besides just working on problem solving, you need to look at what tools and skills you bring to the table when you do so. If you were going to work on a new feature at work, do you just sit down with no IDE, no debugger, no documentation, no internet, and no source code? Of course not!

There are tools for solving problems, you just don't know them....yet. The wikipedia article has some links to problem solving techniques. But the most important tool is the scientific method. The wikipedia article includes a pragmatic approach:

  1. Define a question
  2. Gather information and resources (observe)
  3. Form an explanatory hypothesis
  4. Test the hypothesis by performing an experiment and collecting data in a reproducible manner
  5. Analyze the data
  6. Interpret the data and draw conclusions that serve as a starting point for new hypothesis
  7. Publish results
  8. Retest (frequently done by other scientists)

All problems can be solved this way! Many people don't go through these steps though. It's like a developer who refuses to test his code. At all. He'll have problems figuring out bugs even exist.

Finally, the other primary tool for problem solving is break it down with simple steps. For example, the first problem in project Euler's examples:

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

We have two facts, and a problem here. Fact one shows us how to define a multiple of three or five below 10. 3*1,3*2,3*3,5*1 are all valid. 5*2 is not because it equals 10. Then, fact two tells us that we add them together to get 23.

So we already have a method of finding values, and we can add them together to get our sum. Of course, we can look at the facts and apply a simple reverse of the order. 3, 5, 6 and 9 are multiples of 3 or 5. That is 3 % 3, 5 % 5, 6 % 3, 9 % 3 all give a mod of zero. So another approach would be to go through 999 to 1 and modulus each number with 3 and 5. Collect the list of values and add them together.

I would suggest The art of unix programming as an excellent example of using small tools in the programming world. Chaining them together allows you to solve very complex problems, and I can't count the number of times these concepts have helped me.

share|improve this answer

I feel I should add to this.

As the chosen answer has already stated, knowing your weakness is a huge advantage, and there are some basic tools for learning problem solving techniques. What I think is lacking in the answer, though, is simply just to find ways to practice difficult problems - a lot. Be stubborn about fully finishing every problem you try. Reading code, lots of code, is good, as is reading books on the subject of problem solving, but writing code is almost more important.

In some ways, we share the same weakness (although, it is not as bad as you think). To practice my problem solving skills, I am always working on some project Euler or HackerRank problem. If it's an easy problem, I pick 7 programming languages and try to solve it in all of them. For harder problems, I might pick 3 languages that are very different from each other, just to keep the time I spend on the problem reasonable. For all of the problems, once I've come up with a solution, I search out the solutions others have come up with and make sure I understand them. If you don't understand some solution, you can always post to StackOverflow or probably even here to Programmers Stack Exchange or something and I'm sure there's someone on the site who could answer your question (it's rare that there isn't).

Basically, though, make sure you are practicing, and not just reading, and practice a lot. Just like sports, clear thinking takes time and effort.

Another thing you can do to help aid the way you think about problems is to write the test suite for the problems you solve first. You cannot write a good test for a problem without first fully understanding it. If you do this for different languages, this has the advantage of teaching you different testing techniques at the same time.

share|improve this answer

Many programmers are also natural "puzzle solvers", but there is so much more to programming than that. If all programmers were focused on solving interesting algorithmical problems, we would have loads and loads of software which could solve cool problems, but none of them would be usable or maintainable.

I find that there are relatively few "puzzle-solving" type challenges in my work. Most of the challenges are more about studying old code, learning a new API, designing the architecture of some component in a way that people will not swear over it in three years time. All of this is challenging, but not so much of the logic puzzle kind. On the other hand, I have colleagues who spend most of their time thinking about compiler optimization algorithms, and who are very good at that.

I think it is important for programmers to constantly think about "how can I get better at what I do?", but being a good programmer doesn't necessarily require that you are great at puzzle solving.

Personally, I get my puzzle solving fix by solving "mystery geocaches".

share|improve this answer
    
But alot of the hot startups ONLY stress of puzzle solving skills. Take facebook. If I am not good at puzzle solving, I am not even eligible to apply there! –  John Oct 20 '11 at 6:48
5  
Facebook has the puzzle robot as a first check just to avoid having to sift through thousands and thousands of CVs. If you really want to work for FB, then you need to be able to solve those kinds of problems, but there are lots and lots of other good places to work for. –  JesperE Oct 20 '11 at 7:02
    
fantastic answer. puts me at ease as well... =] –  Hartley Brody Oct 20 '11 at 19:15

Firts of all, knowing your weakness is an actual strength, hence you know what to study to get a better game.

My advise would be, read a lot of code that solves logic problems. Everyone has their own style in solving puzzles, reading code might hint you at a way how you can learn to do this. Plus being able to understand the code probably also points you to the mathematical theory that describes the problem, so along the way you'll learn about the underlying problems as well.

Cheers, Carlo

share|improve this answer

Most programming jobs don't require a lot of logic. But these might not be the jobs you like.

As a general guideline, try to learn algorithms and structures. I can advise Skiena's The Algorithm Design manual. Once you know these you'll start categorizing problems. This looks a lot like the traveling salesmen problem, here I can use a tree, here i can use a binary search...

Project Euler has a wide variation of puzzles. A lot of these are easily doable with a basic math knowledge. Others are easier solved once you know a few of these algorithms.

share|improve this answer
    
+1 for Skiena's The Algorithm Design manual –  zengr Oct 21 '11 at 19:05

Let me just warn you, the more you know, the more you realize just how little you know.

Just don't get discouraged by that. Keep on learning and trying to work on areas you realize are lacking.

Now on to your question. My suggestion would be to start working on the problems on project euler.

My reasons for this are simple, start at the most popular question, these are normally the easier problems to solve.

When you are confronted with a problem, try and solve it, work on it on your own, try different approaches. The way project euler works allows you to check and test your answer.

If you decide that you can't solve this problem, start researching the problem (not looking for the answer). No try again.

Once you solve the problem, project euler has a section where they show you the best answers for each language implementation. Go over their answer in your preferred language, understand their solution and the thinking that went into it.

Now close the answer they provided, and try again on your own until you solve it again.

If you practice enough, the logic and thinking to solve these problems will get easier and easier to you.

share|improve this answer

I very much believe that you have just started off with your journey in programming, so first thing if it takes you some time to even grasp and get it right it seems to be a non issue. The only difference what it makes is with each attempt are you learning something like WoW ! ! the last thing i did doesn't make sense at all coz i needed decimal and not double

If solving puzzle doesn't interest you then don't go about head hunting for that, there are other logical issues floating around once you know your code base, you may choose to work on them and present any suggested edits to your mentor or lead. (don't worry if you do some blunder they would help you know why your methodology is faulty, so be a keen observer and an apt listener)

It will take some time for you to settle down and then may be you might get going on firing on all cylinders. Needless to say avoid the urge of searching for a solution on google or SO, put in some efforts from your end and only fire up your browser when you are in doubt or absolutely clueless

share|improve this answer

protected by MichaelT Dec 30 '13 at 5:39

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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