Challenge 64 #1

Run Settings
LanguageRaku
Language Version
Run Command
multi best-path([]) { [] } multi best-path([[$v]]) { $v } multi best-path([@v]) { @v } multi best-path(@v where all(@v).elems == 1) { @v[*; 0] } multi best-path(@v) { my @a = best-path @v[1..*]; my @b = best-path @v.map: { .[1..*] } [ @v[0; 0], @a.sum > @b.sum ?? |@b !! |@a ] } say best-path [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; say best-path [[7, 4, 5, 1], [5, 3, 1, 0]]; say best-path [[0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [1, 1, 0, 1, 1], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0]]; say best-path [[]];
Editor Settings
Theme
Key bindings
Full width
Lines