diff options
| author | BarrOff <58253563+BarrOff@users.noreply.github.com> | 2023-05-29 00:09:01 +0200 |
|---|---|---|
| committer | BarrOff <58253563+BarrOff@users.noreply.github.com> | 2023-05-29 00:09:01 +0200 |
| commit | 5b6caee89ff54943ee2172c349f475127b7ea34d (patch) | |
| tree | b2a16512408af599dc70530666fcbd018f974795 | |
| parent | b0daa9e2188ce8f42f0d82925afe3c2738914093 (diff) | |
| download | perlweeklychallenge-club-5b6caee89ff54943ee2172c349f475127b7ea34d.tar.gz perlweeklychallenge-club-5b6caee89ff54943ee2172c349f475127b7ea34d.tar.bz2 perlweeklychallenge-club-5b6caee89ff54943ee2172c349f475127b7ea34d.zip | |
feat: allow maximum product of `k` elements
| -rw-r--r-- | challenge-218/barroff/raku/ch-1.raku | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-218/barroff/raku/ch-1.raku b/challenge-218/barroff/raku/ch-1.raku index b836ad597d..5f14669046 100644 --- a/challenge-218/barroff/raku/ch-1.raku +++ b/challenge-218/barroff/raku/ch-1.raku @@ -2,8 +2,8 @@ use v6.d; -sub maximum-product(Int:D @numbers where @numbers.elems ≥ 3 --> Int) { - return max(map({ [*] $_ }, @numbers.combinations(3))); +sub maximum-product(Int:D @numbers where @numbers.elems ≥ 3, Int:D $k = 3 --> Int) { + return max(map({ [*] $_ }, @numbers.combinations($k))); } #| Run test cases |
