When I decided to start programming one of the first places I visited was Project Euler, not because it would teach me how to program but because it had the perfect challenges for using programming to solve problems when starting out learning to code. The problems are based on mathematics, starting off very easy (think fizzbuzz type thing) where it is mostly the programming part that is the challenge but very quickly the problems become harder and increasingly you have to recall your mathematics knowledge in combination with programming skill to get to the answer.
Once you manage to enter the correct answer to the problem you get access to the forum for that particular problem to see what everyone else's solution is. This is the most interesting part! Posted are solutions using all manner of languages such as Haskell, Lua, Pascal etc (looking at the statistics page there are 74 different languages among the users!) and the first solutions were published 9 years ago. You can really see the effort made in the beginning (at least for the first 30-40 problems that I have tackled) to optimize the code to run faster which seem to be decreasing these days with faster PCs.
Also apparent is the solutions by mathematicians where not a line of code seem to have been written before thorough boundary analysis has taken place and the problem has been thought out using standard mathematical rules that once pointed out seem obvious, but as coders we often seem to leave the the computers to take care of, giving them often more than twice the amount of work necessary.
If there ever was a website to inspire you to try a different language or see how clever people use logic and mathematics before coding a solution, this is it! Have a go but beware it is quite addictive!
No comments:
Post a Comment