From 0468084b856d79ab5dca03235eab017a4d1ebfc4 Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:17:27 +0000 Subject: initial 151 --- challenge-151/mark-anderson/raku/ch-2.raku | 11 ++++++++--- 1 file 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) -- cgit