RosettaCodeData/Task/Maximum-triangle-path-sum/Perl-6/maximum-triangle-path-sum-1.pl6

9 lines
183 B
Raku
Raw Permalink Normal View History

2015-02-20 09:02:09 -05:00
my @rows = slurp("triangle.txt").lines.map: { [.words] }
while @rows > 1 {
my @last := @rows.pop;
2015-11-18 06:14:39 +00:00
@rows[*-1] = (@rows[*-1][] Z+ (@last Zmax @last[1..*])).List;
2015-02-20 09:02:09 -05:00
}
say @rows;