Re: [Tutor] Euler Spoiler

2014-01-15 Thread Steven D'Aprano
On Sun, Jan 12, 2014 at 09:56:09PM -0800, Danny Yoo wrote: > Here's a sketch of how I'd attack this by considering a DP-style > approach. If you want to avoid any spoilers, please skip this > message. > > Otherwise, I'll try to be as transparent as to my thought process as I can. [snip] Nicely

Re: [Tutor] Euler Spoiler

2014-01-13 Thread Keith Winston
Ah, I got through it. Yes, I started down this path, but didn't dot the i's. Thanks. I'm going to do some more reading on dynamic programming... Keith On Mon, Jan 13, 2014 at 12:51 PM, Keith Winston wrote: > Danny, thanks for that exposition. I don't have time to absorb it > yet,though I will at

Re: [Tutor] Euler Spoiler

2014-01-13 Thread Keith Winston
Danny, thanks for that exposition. I don't have time to absorb it yet,though I will attempt to soon, but I wanted to thank you for your effort in the meantime. Keith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: h

Re: [Tutor] Euler Spoiler

2014-01-12 Thread Danny Yoo
To be concrete, I think you're looking at Problem 31, right? http://projecteuler.net/problem=31 in which case, we have a few choices for denomination: 1p, 2p, 5p, 10p, 20p, 50p, 100p, 200p and we're trying to _count_ how many ways to make 200p. Here's a sketch of how I'd attack this

Re: [Tutor] Euler Spoiler

2014-01-12 Thread Keith Winston
Thanks everyone, things to chew on. I'll look at the other itertools functions mentioned. I did solve Proj. Euler 15 & 18 (and it's corresponding 67), one more elegantly than the other, and I have given some thought to how to break this one down, but haven't figured it out yet. I think I might not

Re: [Tutor] Euler Spoiler

2014-01-12 Thread Dave Angel
Keith Winston Wrote in message: > I'm working through some of the Project Euler problems, and the > following might spoil one of the problems, so perhaps you don't want > to read further... > > > The problem relates to finding all possible combinations of coins that > equal a given total. I'm b

Re: [Tutor] Euler Spoiler

2014-01-12 Thread Danny Yoo
This sounds very much like a problem that demands trying to break the problems down into subproblems, and then applying a "dynamic-programming approach" to make it fairly easy to get an efficient solution. Such problems that are amendable to this approach have a "substructure" to them so that the

Re: [Tutor] Euler Spoiler

2014-01-12 Thread Walter Prins
Hi Keith, On 12 January 2014 23:12, Keith Winston wrote: > I'm working through some of the Project Euler problems, and the > following might spoil one of the problems, so perhaps you don't want > to read further... > > > The problem relates to finding all possible combinations of coins that > eq

[Tutor] Euler Spoiler

2014-01-12 Thread Keith Winston
I'm working through some of the Project Euler problems, and the following might spoil one of the problems, so perhaps you don't want to read further... The problem relates to finding all possible combinations of coins that equal a given total. I'm basically brute-forcing it, which is probably not