I’ve been fiddling about with Project Euler (I’m about a dozen questions in) using Python and I’m painfully aware that I’ve been taking the easiest route through all of the problems each time—bruteforce searches with minimal optimization. When reading through the discussion threads after I solve the problem, I’ll often come across a wonderfully elegant solution and at once understand it and then kick myself for not coming up with it. The problem is that I feel like I’m looking at a bunch of clever tricks without the insight needed to understand why I should have embarked on that line of reasoning. I guess what I’m asking is, what are some good books or resources I can consume in order to better my understanding of how to solve these kinds of problems?
Just more Euler problems will help, though they may not be optimal. Around problem 50, brute force stops being a viable option, and you have to start referencing wikipedia and, sometimes, the resources wikipedia lists. By the time you reach 100, the problems start getting genuinely hard (for me, they may not get hard until significantly after that for you). See if you can solve each problem with paper and pencil before you even create a program, or, if you must create a program, use it to test a hypothesis instead of to find the answer.
For bonus points, try to get your algorithms down to one second of running time once you get a working algorithm.
Disclaimer: I myself have only been programming for about a year, and while I have been told I write very good code by my manager, I’m still an amateur
Thanks for that—and they’ll probably start getting hard for me quite a bit before 100. I’ve nowhere near the programming experience of you; I’ve been partially using Project Euler to teach myself Python.
I did the same, though I went into them knowing a small amount of Java and a similar amount of JavaScript. I doubt the Euler problems are the optimal way to learn a language, but they’re certainly a really, really good one.
I’ve been fiddling about with Project Euler (I’m about a dozen questions in) using Python and I’m painfully aware that I’ve been taking the easiest route through all of the problems each time—bruteforce searches with minimal optimization. When reading through the discussion threads after I solve the problem, I’ll often come across a wonderfully elegant solution and at once understand it and then kick myself for not coming up with it. The problem is that I feel like I’m looking at a bunch of clever tricks without the insight needed to understand why I should have embarked on that line of reasoning. I guess what I’m asking is, what are some good books or resources I can consume in order to better my understanding of how to solve these kinds of problems?
Just more Euler problems will help, though they may not be optimal. Around problem 50, brute force stops being a viable option, and you have to start referencing wikipedia and, sometimes, the resources wikipedia lists. By the time you reach 100, the problems start getting genuinely hard (for me, they may not get hard until significantly after that for you). See if you can solve each problem with paper and pencil before you even create a program, or, if you must create a program, use it to test a hypothesis instead of to find the answer.
For bonus points, try to get your algorithms down to one second of running time once you get a working algorithm.
Disclaimer: I myself have only been programming for about a year, and while I have been told I write very good code by my manager, I’m still an amateur
Thanks for that—and they’ll probably start getting hard for me quite a bit before 100. I’ve nowhere near the programming experience of you; I’ve been partially using Project Euler to teach myself Python.
I did the same, though I went into them knowing a small amount of Java and a similar amount of JavaScript. I doubt the Euler problems are the optimal way to learn a language, but they’re certainly a really, really good one.