From: Devin Mullins Date: 2006-09-25T01:04:07+09:00 Subject: Re: Help w/ Codegolf Total Triangles- reading input Drew Olson wrote: > Work backwards row by row. In each row, compare the current element with > the next, and whichever ever is larger, add this number to the element > in the same index in the next highest row. Eventually, the value in > a[0][0] will be the largest path...does this makes sense? Is it an > effective strategy? Yeah, that does seem like it'll work. I never thought of it that way. Think of the forwards algorithm, too. Then determine if the code you write with the backwards is 8 bytes shorter (to make up for reverse_each vs each). (I'll have to look at it, myself. :P) One more hint: You probably don't need to waste your time with map. Consider: a=readlines.each{|i|i.split(" ").each{|j|j=j.to_i}} a.reverse_each{|r|p r[0]} vs: readlines.reverse_each{|l|l.split(" ")[0].to_i} Again, try it both ways and see. (Keeping in mind that if the difference is small, then the winner's not certain -- the little optimizations could tip it either way.) I could suggest more things, but I don't wanna lose my spot. It's the one challenge at which I was actually successful. :) Devin Wow... acting as if I'm an expert after a few little internet challenges... Well, grain of salt and all that.