diff options
| author | Mark <53903062+andemark@users.noreply.github.com> | 2022-02-07 13:17:27 +0000 |
|---|---|---|
| committer | Mark <53903062+andemark@users.noreply.github.com> | 2022-02-07 13:17:27 +0000 |
| commit | 0468084b856d79ab5dca03235eab017a4d1ebfc4 (patch) | |
| tree | 79bb660fd3711223c7d0d4685ef1440b604b1e0c | |
| parent | 640ba1f04df03a2835067fd91cee9a6fbece083a (diff) | |
| download | perlweeklychallenge-club-0468084b856d79ab5dca03235eab017a4d1ebfc4.tar.gz perlweeklychallenge-club-0468084b856d79ab5dca03235eab017a4d1ebfc4.tar.bz2 perlweeklychallenge-club-0468084b856d79ab5dca03235eab017a4d1ebfc4.zip | |
initial 151
| -rw-r--r-- | challenge-151/mark-anderson/raku/ch-2.raku | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/challenge-151/mark-anderson/raku/ch-2.raku b/challenge-151/mark-anderson/raku/ch-2.raku index bb7d64b1dd..bb9002588d 100644 --- a/challenge-151/mark-anderson/raku/ch-2.raku +++ b/challenge-151/mark-anderson/raku/ch-2.raku @@ -7,14 +7,19 @@ use Test; is rob(2, 4, 5), 7; is rob(4, 2, 3, 6, 5, 3), 13; -multi rob(+@houses where .elems < 3) +multi rob(+@houses where .elems == 1) { - return @houses.head; + return @houses[0]; +} + +multi rob(+@houses where .elems == 2) +{ + return max(@houses[0], @houses[1]); } multi rob(+@houses where .elems == 3) { - return @houses[0] + @houses[2]; + return max(@houses[1], @houses[0] + @houses[2]); } multi rob(+@houses) |
