sergeytrasko / project-euler

My solutions to Project Euler problems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project Euler Solutions

My profile

https://projecteuler.net

Why I solve Project Euler problems

First of all - it is fun. Some 20 years back I used to participate in programming competitions (i.e. solving algorithmic problems). Since that I'm mostly working in enterprise environment and solving different types of problems. It's always good to shake your memory.

Secondly - it allows me to switch focus from my day-to-day work and refresh my former knowledge.

Thirdly - it forces me to discover new things for me, new algorithms, new approaches, etc.

And last, but not least - I do enjoy cracking these quite challenging problems.

Things I learned solving Project Euler problems

My strategy

  • Don't look for other people solutions (as it turned out you can quite easily find the solution for almost all problems) - try to solve it myself first. It will be more fun than just copying the result from the others.
  • Try to figure out algorithm complexity beforehand. Efficient algorithm for Project Euler problem should check at most 50'000'000 possibilities (to fit into recommended time limit of 1 minute). For example if I see that need to find sum of numbers below 10^7 - it gives a clue that every number should be checked in constant time (i.e. O(1)).
  • One cannot know all algorithms - it's OK to google algorithms and ideas of solutions.
  • Solution that runs over 10 seconds on a modern hardware is most likely sub-optimal. Project Euler states that the reasonable limit for the program to find a solution is one minute, but I think only a couple of my solutions run slower than 15 seconds. If I see that I go over this limit I spend some time figuring out what can be improved.
  • After I solved the problem I try to google solutions of other people to verify my ideas and learn something from others.
  • Project Euler opens you an internal discussion thread for a problem once you solve it - it's good to check other people ideas there.

Solved problems

Here are my solved problems. For all of them source code is available plus some very brief explanation of my solution. Mostly breakdown does not explain each and every aspect of the solution - my goal is to provide you a hint how to address the problem.

About

My solutions to Project Euler problems


Languages

Language:Go 100.0%