Alex Rivera | Logout

Is a preference for brute force solutions a bad sign?

Asked 2009-01-06T22:37:16.567
12

I'm a beginner C++ programmer, and to stretch my mind I've been trying some of the problems on projecteuler.net. Despite an interest in maths at school, I've found myself automatically going for brute force solutions to the problems, rather than looking for something streamlined or elegant.

Does this sound like a bad mindset to have? I feel a bit guilty doing it like this, but maybe quick and dirty is OK some of the time...

Edit
Report

1 Answer

1

Do you fit inside the 1 minute runtime rule for the problems? If yes, then your "brute force" solution fulfils all the requirements, and that's actually a very good sign that you can quickly come up with something that works!

These kinds of problems encourage micro-optimisation and very clever algorithms, but in general a very readable straightforward implementation will be much easier to maintain, and will be favoured in the business world.

answered 2009-01-06T22:46:20.587

Your Answer