diff options
| author | 冯昶 <fengchang@novel-supertv.com> | 2021-02-22 22:25:54 +0800 |
|---|---|---|
| committer | 冯昶 <fengchang@novel-supertv.com> | 2021-02-22 22:25:54 +0800 |
| commit | 3cc47d00aee13d50c872499cecf574539a4cbe2a (patch) | |
| tree | 77b6f6a1e8cae075e3c70fa1b4f82e85aa390743 /challenge-075 | |
| parent | 572994875f5972916deabeb84f3648ac4640107b (diff) | |
| download | perlweeklychallenge-club-3cc47d00aee13d50c872499cecf574539a4cbe2a.tar.gz perlweeklychallenge-club-3cc47d00aee13d50c872499cecf574539a4cbe2a.tar.bz2 perlweeklychallenge-club-3cc47d00aee13d50c872499cecf574539a4cbe2a.zip | |
challenge 101, raku solutions
Diffstat (limited to 'challenge-075')
| -rwxr-xr-x | challenge-075/feng-chang/raku/ch-2.raku.local | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-075/feng-chang/raku/ch-2.raku.local b/challenge-075/feng-chang/raku/ch-2.raku.local new file mode 100755 index 0000000000..d64b758512 --- /dev/null +++ b/challenge-075/feng-chang/raku/ch-2.raku.local @@ -0,0 +1,13 @@ +#!/bin/env raku + +sub largest-rectangle-histogram(Int:D @A) { + my Int $n = @A.elems; + for 0..($n-1) -> $i { + for $i..($n-1) -> $j { + say min(|@A[$i..$j]) * ($j - $i + 1); + } + } +} + +largest-rectangle-histogram(my Int @ = 2, 1, 4, 5, 3, 7); +largest-rectangle-histogram(my Int @ = 3, 2, 3, 5, 7, 5); |
