Daniel Martin wrote: > I think we might get a nice solution combining this trick with the > object I used in my second solution that behaved like 0 with regards > to arithmetic, but had a to_s method that returned "". I like that solution. I was thinking that I wanted something like this when I was working on my solution. > I do worry about the memory used by your solution, since you need to > have half of the whole tree in memory at once. I know a lot of people mentioned this as a possible issue with solutions in general here, but this really doesn't seem like an issue to me. The whole tree for say 1000 rows is only something like around 250,250 digits here, (n(n+1)/2)/2 (as stored in the Hashes). I'm not sure of the size of the digits in actual RAM but that doesn't really seem like a lot. I'm guessing not more than maybe 5M total, counting the keys (another digit for each). Seems like a pretty minor cost to me for what I might do to fix it. Personally, I'd rather have code that is easier to read or finish faster than take up a chunk of memory. But this is maybe just my preference. -- Posted via http://www.ruby-forum.com/.