aboutsummaryrefslogtreecommitdiff
path: root/challenge-075
diff options
context:
space:
mode:
author冯昶 <fengchang@novel-supertv.com>2021-02-22 22:25:54 +0800
committer冯昶 <fengchang@novel-supertv.com>2021-02-22 22:25:54 +0800
commit3cc47d00aee13d50c872499cecf574539a4cbe2a (patch)
tree77b6f6a1e8cae075e3c70fa1b4f82e85aa390743 /challenge-075
parent572994875f5972916deabeb84f3648ac4640107b (diff)
downloadperlweeklychallenge-club-3cc47d00aee13d50c872499cecf574539a4cbe2a.tar.gz
perlweeklychallenge-club-3cc47d00aee13d50c872499cecf574539a4cbe2a.tar.bz2
perlweeklychallenge-club-3cc47d00aee13d50c872499cecf574539a4cbe2a.zip
challenge 101, raku solutions
Diffstat (limited to 'challenge-075')
-rwxr-xr-xchallenge-075/feng-chang/raku/ch-2.raku.local13
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);