How to spend nights on the computer
Hi everyone,
As you may already know, I love solving problems. And what I love most is to use KISS principle, and reduce those problems into items so small that they all seem trivial.
Some time ago, as I was searching for a way to improve my programming skills, I fell on the Project Euler.
And since my life has never been the same :p.
The principle of Project Euler is simple : Solve a problem that takes only a few lines to explain in less than one minute using any tool you want (understand any programming language :p).
The first problems are trivial, but as you may expect get more and more complicated over time.
This is one of the best tools to be used if you want to learn about tricks for a given language. As you solve problems, you will find more and more difficult to pass the one minut limit. You will finally be forced to search for clever ways to solve your problems and this should lead you to beautiful code.
You will have to search for tricks such as generators, memoization, sieves, . . . which will surely lead you to be a better coder every day !
What I really love in Project Euler is how their problems are simple to understand, but challenging to be solved efficiently. Usually, the best solution is not the one you would have thought about :).
I decided to solve all my problems in Python, because it is simple and powerful. I felt in love with Python some time ago, and always feel like magic is going on when using it :).
As a motivation, and to share my achievements I keep sharing my solutions on github and try to document them as much as possible.
By now, I solved my 36th problem yesterday and never spend a day without hacking for an hour or two :).
Try it, and let me know if you spend some nights solving problems too !
BTW, be careful because there are plenty of solutions on the web (including my github). I use others code only afterwards to check if they have popped out with a more elegant solution than mine.
(Ok, I cheated for the Dijkstra's algorithm; knowing that I had to use it but too lazy to implement it by myself. . . )
Enjoy ;)