3 ms·
1) Start with a brute force solution, and then look for optimizations. A good way to do this is have it print out (or display in some form) each of its guesses.
by gizmo686 14y ago
1) Start with a brute force solution, and then look for optimizations. A good way to do this is have it print out (or display in some form) each of its guesses. You will almost allways see it do something stupid, at which point you found an optimization.
2) Write downs as many observations about the problem as you can; if possible, write them down in mathematical notation. See what you can find by combining observations.
3) If you have some sense of what a solution might look like, write it down and see where it goes; don't wait until you think you have the entire answer.
4) When you look at other people algorithms, as soon as you see them do something you didn't, put there paper to the side, do what they did, and see where you can take it on your own.
5) If what you are doing looks related to a subject you are not fammilar with, research that subject.
6) Similarly, if you can reduce a problem (or sub-problem) to another one, but you have no idea how to solve the new one, research to see if people have already solved your new one.
7) If you every see a sequence of numbers, go here: http://oeis.org/ http://oeis.org/
7b) If the only description in oeis is a link to the Project Euler problem you are solving, then this technique is probably to cheety.
8) Invent to variables/functions
9) Math notation is there to help you, make up your own if it expresses the problem more cleanly.
10) Never right a false statement on your work paper unless it is clearly indicated by words like "assume" or "not".
10b) If you see a statement on one of your papers, assume that it is true even if you forgot why.
- manish_gill 14y agoThank you for writing that. I've been struggling with this for quite a while and your pointers can help me be someone more clever than a brute-force code-monkey. :)