aboutsummaryrefslogtreecommitdiff
path: root/challenge-130
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-09-19 17:30:31 +0100
committerGitHub <noreply@github.com>2021-09-19 17:30:31 +0100
commit4800f8c3bf69f24e3746ebac863caa43679e73f1 (patch)
tree0fb06b24397135cca37d6422da34f25e89c947b1 /challenge-130
parent9e1015105d116e7543a03f633ac2894ad045e095 (diff)
parent2df2f2662d99fb4029508feb84f0342664c51b59 (diff)
downloadperlweeklychallenge-club-4800f8c3bf69f24e3746ebac863caa43679e73f1.tar.gz
perlweeklychallenge-club-4800f8c3bf69f24e3746ebac863caa43679e73f1.tar.bz2
perlweeklychallenge-club-4800f8c3bf69f24e3746ebac863caa43679e73f1.zip
Merge pull request #4892 from arnesom/branch-for-challenge-130
Arne Sommer
Diffstat (limited to 'challenge-130')
-rw-r--r--challenge-130/arne-sommer/Graphviz/example1.dot12
-rw-r--r--challenge-130/arne-sommer/Graphviz/example1.svg87
-rw-r--r--challenge-130/arne-sommer/Graphviz/example2.dot12
-rw-r--r--challenge-130/arne-sommer/Graphviz/example2.svg87
-rw-r--r--challenge-130/arne-sommer/blog.txt1
-rwxr-xr-xchallenge-130/arne-sommer/perl/ch-1.pl23
-rwxr-xr-xchallenge-130/arne-sommer/perl/odd-number-perl23
-rwxr-xr-xchallenge-130/arne-sommer/raku/bin-graph12
-rwxr-xr-xchallenge-130/arne-sommer/raku/bin-test10
-rwxr-xr-xchallenge-130/arne-sommer/raku/binary-search-tree12
-rwxr-xr-xchallenge-130/arne-sommer/raku/binary-search-tree214
-rwxr-xr-xchallenge-130/arne-sommer/raku/ch-1.raku15
-rwxr-xr-xchallenge-130/arne-sommer/raku/ch-2.raku14
-rw-r--r--challenge-130/arne-sommer/raku/lib/BinaryNode.rakumod79
-rw-r--r--challenge-130/arne-sommer/raku/lib/BinaryNode2.rakumod93
-rwxr-xr-xchallenge-130/arne-sommer/raku/odd-number15
16 files changed, 509 insertions, 0 deletions
diff --git a/challenge-130/arne-sommer/Graphviz/example1.dot b/challenge-130/arne-sommer/Graphviz/example1.dot
new file mode 100644
index 0000000000..87863e87c6
--- /dev/null
+++ b/challenge-130/arne-sommer/Graphviz/example1.dot
@@ -0,0 +1,12 @@
+digraph foogrph {
+ node [shape = record,height=.1];
+ node8[label = "<left> |<center> 8|<right> "];
+ "node8":left -> "node5":center;
+ node5[label = "<left> |<center> 5|<right> "];
+ "node5":left -> "node4":center;
+ node4[label = "<left> |<center> 4|<right> "];
+ "node5":right -> "node6":center;
+ node6[label = "<left> |<center> 6|<right> "];
+ "node8":right -> "node9":center;
+ node9[label = "<left> |<center> 9|<right> "];
+}
diff --git a/challenge-130/arne-sommer/Graphviz/example1.svg b/challenge-130/arne-sommer/Graphviz/example1.svg
new file mode 100644
index 0000000000..651605a75a
--- /dev/null
+++ b/challenge-130/arne-sommer/Graphviz/example1.svg
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.43.0 (0)
+ -->
+<!-- Title: foogrph Pages: 1 -->
+<svg width="192pt" height="152pt"
+ viewBox="0.00 0.00 192.00 152.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 148)">
+<title>foogrph</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-148 188,-148 188,4 -4,4"/>
+<!-- node8 -->
+<g id="node1" class="node">
+<title>node8</title>
+<polygon fill="none" stroke="black" points="80,-120.5 80,-143.5 143,-143.5 143,-120.5 80,-120.5"/>
+<text text-anchor="middle" x="90" y="-128.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="100,-120.5 100,-143.5 "/>
+<text text-anchor="middle" x="111.5" y="-128.3" font-family="Times,serif" font-size="14.00">8</text>
+<polyline fill="none" stroke="black" points="123,-120.5 123,-143.5 "/>
+<text text-anchor="middle" x="133" y="-128.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node5 -->
+<g id="node2" class="node">
+<title>node5</title>
+<polygon fill="none" stroke="black" points="40,-60.5 40,-83.5 103,-83.5 103,-60.5 40,-60.5"/>
+<text text-anchor="middle" x="50" y="-68.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="60,-60.5 60,-83.5 "/>
+<text text-anchor="middle" x="71.5" y="-68.3" font-family="Times,serif" font-size="14.00">5</text>
+<polyline fill="none" stroke="black" points="83,-60.5 83,-83.5 "/>
+<text text-anchor="middle" x="93" y="-68.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node8&#45;&gt;node5 -->
+<g id="edge1" class="edge">
+<title>node8:left&#45;&gt;node5:center</title>
+<path fill="none" stroke="black" d="M89.5,-120C89.5,-106.16 78.73,-102.9 73.85,-93.85"/>
+<polygon fill="black" stroke="black" points="77.23,-92.91 71.5,-84 70.42,-94.54 77.23,-92.91"/>
+</g>
+<!-- node9 -->
+<g id="node5" class="node">
+<title>node9</title>
+<polygon fill="none" stroke="black" points="121,-60.5 121,-83.5 184,-83.5 184,-60.5 121,-60.5"/>
+<text text-anchor="middle" x="131" y="-68.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="141,-60.5 141,-83.5 "/>
+<text text-anchor="middle" x="152.5" y="-68.3" font-family="Times,serif" font-size="14.00">9</text>
+<polyline fill="none" stroke="black" points="164,-60.5 164,-83.5 "/>
+<text text-anchor="middle" x="174" y="-68.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node8&#45;&gt;node9 -->
+<g id="edge4" class="edge">
+<title>node8:right&#45;&gt;node9:center</title>
+<path fill="none" stroke="black" d="M133.5,-120C133.5,-106.01 144.87,-102.95 150.02,-93.91"/>
+<polygon fill="black" stroke="black" points="153.46,-94.55 152.5,-84 146.67,-92.85 153.46,-94.55"/>
+</g>
+<!-- node4 -->
+<g id="node3" class="node">
+<title>node4</title>
+<polygon fill="none" stroke="black" points="0,-0.5 0,-23.5 63,-23.5 63,-0.5 0,-0.5"/>
+<text text-anchor="middle" x="10" y="-8.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="20,-0.5 20,-23.5 "/>
+<text text-anchor="middle" x="31.5" y="-8.3" font-family="Times,serif" font-size="14.00">4</text>
+<polyline fill="none" stroke="black" points="43,-0.5 43,-23.5 "/>
+<text text-anchor="middle" x="53" y="-8.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node5&#45;&gt;node4 -->
+<g id="edge2" class="edge">
+<title>node5:left&#45;&gt;node4:center</title>
+<path fill="none" stroke="black" d="M49.5,-60C49.5,-46.16 38.73,-42.9 33.85,-33.85"/>
+<polygon fill="black" stroke="black" points="37.23,-32.91 31.5,-24 30.42,-34.54 37.23,-32.91"/>
+</g>
+<!-- node6 -->
+<g id="node4" class="node">
+<title>node6</title>
+<polygon fill="none" stroke="black" points="81,-0.5 81,-23.5 144,-23.5 144,-0.5 81,-0.5"/>
+<text text-anchor="middle" x="91" y="-8.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="101,-0.5 101,-23.5 "/>
+<text text-anchor="middle" x="112.5" y="-8.3" font-family="Times,serif" font-size="14.00">6</text>
+<polyline fill="none" stroke="black" points="124,-0.5 124,-23.5 "/>
+<text text-anchor="middle" x="134" y="-8.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node5&#45;&gt;node6 -->
+<g id="edge3" class="edge">
+<title>node5:right&#45;&gt;node6:center</title>
+<path fill="none" stroke="black" d="M93.5,-60C93.5,-46.01 104.87,-42.95 110.02,-33.91"/>
+<polygon fill="black" stroke="black" points="113.46,-34.55 112.5,-24 106.67,-32.85 113.46,-34.55"/>
+</g>
+</g>
+</svg>
diff --git a/challenge-130/arne-sommer/Graphviz/example2.dot b/challenge-130/arne-sommer/Graphviz/example2.dot
new file mode 100644
index 0000000000..dd1797451c
--- /dev/null
+++ b/challenge-130/arne-sommer/Graphviz/example2.dot
@@ -0,0 +1,12 @@
+digraph foogrph {
+ node [shape = record,height=.1];
+ node5[label = "<left> |<center> 5|<right> "];
+ "node5":left -> "node4":center;
+ node4[label = "<left> |<center> 4|<right> "];
+ "node4":left -> "node3":center;
+ node3[label = "<left> |<center> 3|<right> "];
+ "node4":right -> "node6":center;
+ node6[label = "<left> |<center> 6|<right> "];
+ "node5":right -> "node7":center;
+ node7[label = "<left> |<center> 7|<right> "];
+}
diff --git a/challenge-130/arne-sommer/Graphviz/example2.svg b/challenge-130/arne-sommer/Graphviz/example2.svg
new file mode 100644
index 0000000000..1a8d249707
--- /dev/null
+++ b/challenge-130/arne-sommer/Graphviz/example2.svg
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.43.0 (0)
+ -->
+<!-- Title: foogrph Pages: 1 -->
+<svg width="192pt" height="152pt"
+ viewBox="0.00 0.00 192.00 152.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 148)">
+<title>foogrph</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-148 188,-148 188,4 -4,4"/>
+<!-- node5 -->
+<g id="node1" class="node">
+<title>node5</title>
+<polygon fill="none" stroke="black" points="80,-120.5 80,-143.5 143,-143.5 143,-120.5 80,-120.5"/>
+<text text-anchor="middle" x="90" y="-128.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="100,-120.5 100,-143.5 "/>
+<text text-anchor="middle" x="111.5" y="-128.3" font-family="Times,serif" font-size="14.00">5</text>
+<polyline fill="none" stroke="black" points="123,-120.5 123,-143.5 "/>
+<text text-anchor="middle" x="133" y="-128.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node4 -->
+<g id="node2" class="node">
+<title>node4</title>
+<polygon fill="none" stroke="black" points="40,-60.5 40,-83.5 103,-83.5 103,-60.5 40,-60.5"/>
+<text text-anchor="middle" x="50" y="-68.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="60,-60.5 60,-83.5 "/>
+<text text-anchor="middle" x="71.5" y="-68.3" font-family="Times,serif" font-size="14.00">4</text>
+<polyline fill="none" stroke="black" points="83,-60.5 83,-83.5 "/>
+<text text-anchor="middle" x="93" y="-68.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node5&#45;&gt;node4 -->
+<g id="edge1" class="edge">
+<title>node5:left&#45;&gt;node4:center</title>
+<path fill="none" stroke="black" d="M89.5,-120C89.5,-106.16 78.73,-102.9 73.85,-93.85"/>
+<polygon fill="black" stroke="black" points="77.23,-92.91 71.5,-84 70.42,-94.54 77.23,-92.91"/>
+</g>
+<!-- node7 -->
+<g id="node5" class="node">
+<title>node7</title>
+<polygon fill="none" stroke="black" points="121,-60.5 121,-83.5 184,-83.5 184,-60.5 121,-60.5"/>
+<text text-anchor="middle" x="131" y="-68.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="141,-60.5 141,-83.5 "/>
+<text text-anchor="middle" x="152.5" y="-68.3" font-family="Times,serif" font-size="14.00">7</text>
+<polyline fill="none" stroke="black" points="164,-60.5 164,-83.5 "/>
+<text text-anchor="middle" x="174" y="-68.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node5&#45;&gt;node7 -->
+<g id="edge4" class="edge">
+<title>node5:right&#45;&gt;node7:center</title>
+<path fill="none" stroke="black" d="M133.5,-120C133.5,-106.01 144.87,-102.95 150.02,-93.91"/>
+<polygon fill="black" stroke="black" points="153.46,-94.55 152.5,-84 146.67,-92.85 153.46,-94.55"/>
+</g>
+<!-- node3 -->
+<g id="node3" class="node">
+<title>node3</title>
+<polygon fill="none" stroke="black" points="0,-0.5 0,-23.5 63,-23.5 63,-0.5 0,-0.5"/>
+<text text-anchor="middle" x="10" y="-8.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="20,-0.5 20,-23.5 "/>
+<text text-anchor="middle" x="31.5" y="-8.3" font-family="Times,serif" font-size="14.00">3</text>
+<polyline fill="none" stroke="black" points="43,-0.5 43,-23.5 "/>
+<text text-anchor="middle" x="53" y="-8.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node4&#45;&gt;node3 -->
+<g id="edge2" class="edge">
+<title>node4:left&#45;&gt;node3:center</title>
+<path fill="none" stroke="black" d="M49.5,-60C49.5,-46.16 38.73,-42.9 33.85,-33.85"/>
+<polygon fill="black" stroke="black" points="37.23,-32.91 31.5,-24 30.42,-34.54 37.23,-32.91"/>
+</g>
+<!-- node6 -->
+<g id="node4" class="node">
+<title>node6</title>
+<polygon fill="none" stroke="black" points="81,-0.5 81,-23.5 144,-23.5 144,-0.5 81,-0.5"/>
+<text text-anchor="middle" x="91" y="-8.3" font-family="Times,serif" font-size="14.00"> </text>
+<polyline fill="none" stroke="black" points="101,-0.5 101,-23.5 "/>
+<text text-anchor="middle" x="112.5" y="-8.3" font-family="Times,serif" font-size="14.00">6</text>
+<polyline fill="none" stroke="black" points="124,-0.5 124,-23.5 "/>
+<text text-anchor="middle" x="134" y="-8.3" font-family="Times,serif" font-size="14.00"> </text>
+</g>
+<!-- node4&#45;&gt;node6 -->
+<g id="edge3" class="edge">
+<title>node4:right&#45;&gt;node6:center</title>
+<path fill="none" stroke="black" d="M93.5,-60C93.5,-46.01 104.87,-42.95 110.02,-33.91"/>
+<polygon fill="black" stroke="black" points="113.46,-34.55 112.5,-24 106.67,-32.85 113.46,-34.55"/>
+</g>
+</g>
+</svg>
diff --git a/challenge-130/arne-sommer/blog.txt b/challenge-130/arne-sommer/blog.txt
new file mode 100644
index 0000000000..5524f3c8ca
--- /dev/null
+++ b/challenge-130/arne-sommer/blog.txt
@@ -0,0 +1 @@
+https://raku-musings.com/odd-tree.html
diff --git a/challenge-130/arne-sommer/perl/ch-1.pl b/challenge-130/arne-sommer/perl/ch-1.pl
new file mode 100755
index 0000000000..e1dfdc6ce0
--- /dev/null
+++ b/challenge-130/arne-sommer/perl/ch-1.pl
@@ -0,0 +1,23 @@
+#! /usr/bin/env perl
+
+use strict;
+use warnings;
+use feature 'say';
+
+my $numbers = $ARGV[0] // die 'Please specify a string containing numbers';
+
+my @numbers = split(/\s+/, $numbers);
+
+map { /^[1-9]\d*$/ || die "$_ is not an integer" } @numbers;
+
+my %count;
+
+map { $count{$_}++ } @numbers;
+
+my @odd = grep { $count{$_} % 2 } keys %count;
+
+die "Did not find one (and only one) match. Found: "
+ . ( @odd ? join(", ", @odd) : 'none') if @odd != 1;
+
+say join(", ", @odd);
+
diff --git a/challenge-130/arne-sommer/perl/odd-number-perl b/challenge-130/arne-sommer/perl/odd-number-perl
new file mode 100755
index 0000000000..e1dfdc6ce0
--- /dev/null
+++ b/challenge-130/arne-sommer/perl/odd-number-perl
@@ -0,0 +1,23 @@
+#! /usr/bin/env perl
+
+use strict;
+use warnings;
+use feature 'say';
+
+my $numbers = $ARGV[0] // die 'Please specify a string containing numbers';
+
+my @numbers = split(/\s+/, $numbers);
+
+map { /^[1-9]\d*$/ || die "$_ is not an integer" } @numbers;
+
+my %count;
+
+map { $count{$_}++ } @numbers;
+
+my @odd = grep { $count{$_} % 2 } keys %count;
+
+die "Did not find one (and only one) match. Found: "
+ . ( @odd ? join(", ", @odd) : 'none') if @odd != 1;
+
+say join(", ", @odd);
+
diff --git a/challenge-130/arne-sommer/raku/bin-graph b/challenge-130/arne-sommer/raku/bin-graph
new file mode 100755
index 0000000000..27cce1c577
--- /dev/null
+++ b/challenge-130/arne-sommer/raku/bin-graph
@@ -0,0 +1,12 @@
+#! /usr/bin/env raku
+
+use lib "lib";
+use BinaryNode;
+
+unit sub MAIN (Str $tree = "8 | 5 9 | 4 6", :v(:$verbose), :g(:$graph));
+
+my $btree = BinaryNode.create($tree);
+
+say ": { $btree.raku }" if $verbose;
+
+$btree.graph if $graph;
diff --git a/challenge-130/arne-sommer/raku/bin-test b/challenge-130/arne-sommer/raku/bin-test
new file mode 100755
index 0000000000..a30334a777
--- /dev/null
+++ b/challenge-130/arne-sommer/raku/bin-test
@@ -0,0 +1,10 @@
+#! /usr/bin/env raku
+
+use lib "lib";
+use BinaryNode;
+
+unit sub MAIN (Str $tree = "8 | 5 9 | 4 6", :v(:$verbose));
+
+my $btree = BinaryNode.create($tree);
+
+say ": { $btree.raku }" if $verbose;
diff --git a/challenge-130/arne-sommer/raku/binary-search-tree b/challenge-130/arne-sommer/raku/binary-search-tree
new file mode 100755
index 0000000000..1aaf801f16
--- /dev/null
+++ b/challenge-130/arne-sommer/raku/binary-search-tree
@@ -0,0 +1,12 @@
+#! /usr/bin/env raku
+
+use lib "lib";
+use BinaryNode;
+
+unit sub MAIN (Str $tree = "8 | 5 9 | 4 6", :v(:$verbose));
+
+my $btree = BinaryNode.create($tree);
+
+# say ": { $btree.raku }" if $verbose;
+
+say 1 if $btree.min-max(:$verbose);
diff --git a/challenge-130/arne-sommer/raku/binary-search-tree2 b/challenge-130/arne-sommer/raku/binary-search-tree2
new file mode 100755
index 0000000000..bdc1410a68
--- /dev/null
+++ b/challenge-130/arne-sommer/raku/binary-search-tree2
@@ -0,0 +1,14 @@
+#! /usr/bin/env raku
+
+use lib "lib";
+use BinaryNode2;
+
+unit sub MAIN (Str $tree = "8 | 5 9 | 4 6", :v(:$verbose));
+
+my $btree = BinaryNode2.create($tree);
+
+# say ": { $btree.raku }" if $verbose;
+
+say + $btree.is-bst(:$verbose);
+
+# say "Hello"; \ No newline at end of file
diff --git a/challenge-130/arne-sommer/raku/ch-1.raku b/challenge-130/arne-sommer/raku/ch-1.raku
new file mode 100755
index 0000000000..9ad249ea05
--- /dev/null
+++ b/challenge-130/arne-sommer/raku/ch-1.raku
@@ -0,0 +1,15 @@
+#! /usr/bin/env raku
+
+unit sub MAIN ($numbers = "2 5 4 4 5 5 2");
+
+my @numbers = $numbers.words;
+
+die "Positive integers only" unless all(@numbers) ~~ /^<[1..9]>\d*$/;
+
+my %count = @numbers.Bag;
+
+my @odd = %count.keys.grep({ %count{$_} % 2 });
+
+die "Did not find one (and only one) match. Found: { @odd ?? @odd.join(", ") !! 'none' }" if @odd.elems != 1;
+
+say @odd[0];
diff --git a/challenge-130/arne-sommer/raku/ch-2.raku b/challenge-130/arne-sommer/raku/ch-2.raku
new file mode 100755
index 0000000000..bdc1410a68
--- /dev/null
+++ b/challenge-130/arne-sommer/raku/ch-2.raku
@@ -0,0 +1,14 @@
+#! /usr/bin/env raku
+
+use lib "lib";
+use BinaryNode2;
+
+unit sub MAIN (Str $tree = "8 | 5 9 | 4 6", :v(:$verbose));
+
+my $btree = BinaryNode2.create($tree);
+
+# say ": { $btree.raku }" if $verbose;
+
+say + $btree.is-bst(:$verbose);
+
+# say "Hello"; \ No newline at end of file
diff --git a/challenge-130/arne-sommer/raku/lib/BinaryNode.rakumod b/challenge-130/arne-sommer/raku/lib/BinaryNode.rakumod
new file mode 100644
index 0000000000..0ea29776ff
--- /dev/null
+++ b/challenge-130/arne-sommer/raku/lib/BinaryNode.rakumod
@@ -0,0 +1,79 @@
+unit class BinaryNode;
+
+has Int $.value;
+has BinaryNode $.left;
+has BinaryNode $.right;
+
+method create ($string)
+{
+ die "Call on the class only" if self ~~ BinaryNode:D;
+
+ my @btree = $string.split("|")>>.words;
+
+ my @old-nodes;
+ my @new-nodes;
+
+ for @btree.reverse -> $row
+ {
+ my @current = @$row;
+ @old-nodes = @new-nodes;
+ @new-nodes = ();
+
+ for @current -> $value
+ {
+ if $value eq "*"
+ {
+ @new-nodes.push("*");
+ next;
+ }
+
+ my $left = @old-nodes.shift // "*"; $left = Nil if $left eq "*";
+ my $right = @old-nodes.shift // "*"; $right = Nil if $right eq "*";
+
+ @new-nodes.push(BinaryNode.new(value => $value.Int,
+ left => $left // Nil,
+ right => $right // Nil));
+ }
+ }
+
+ return @new-nodes[0];
+}
+
+method graph
+{
+ say 'digraph foogrph {';
+ say ' node [shape = record,height=.1];';
+
+ do-it(self);
+
+ say '}';
+
+ sub do-it ($current)
+ {
+ say " node{ $current.value }[label = \"<left> |<center> { $current.value }|<right> \"];";
+
+ if $current.left.defined
+ {
+ say " \"node{ $current.value }\":left -> \"node{ $current.left.value }\":center;";
+ do-it($current.left);
+ }
+
+ if $current.right.defined
+ {
+ say " \"node{ $current.value }\":right -> \"node{ $current.right.value }\":center;";
+ do-it($current.right);
+ }
+ }
+}
+
+method min-max(:$verbose)
+{
+ my ($left_min, $left_max) = self.left ?? self.left.min-max(:$verbose) !! (self.value, self.value);
+ my ($right_min, $right_max) = self.right ?? self.right.min-max(:$verbose) !! (self.value, self.value);
+
+ say ": Node: { self.value } : Left min: $left_min, max: $left_max | Right min: $right_min, max: $right_max" if $verbose;
+
+ { say 0; exit } if $left_max > self.value || $right_min < self.value;
+
+ return ( min($left_min, $right_min, self.value), max($left_max, $right_max, self.value) );
+}
diff --git a/challenge-130/arne-sommer/raku/lib/BinaryNode2.rakumod b/challenge-130/arne-sommer/raku/lib/BinaryNode2.rakumod
new file mode 100644
index 0000000000..7f66c44b43
--- /dev/null
+++ b/challenge-130/arne-sommer/raku/lib/BinaryNode2.rakumod
@@ -0,0 +1,93 @@
+unit class BinaryNode2;
+
+has Int $.value;
+has BinaryNode2 $.left;
+has BinaryNode2 $.right;
+
+method create ($string)
+{
+ die "Call on the class only" if self ~~ BinaryNode2:D;
+
+ my @btree = $string.split("|")>>.words;
+
+ my @old-nodes;
+ my @new-nodes;
+
+ for @btree.reverse -> $row
+ {
+ my @current = @$row;
+ @old-nodes = @new-nodes;
+ @new-nodes = ();
+
+ for @current -> $value
+ {
+ if $value eq "*"
+ {
+ @new-nodes.push("*");
+ next;
+ }
+
+ my $left = @old-nodes.shift // "*"; $left = Nil if $left eq "*";
+ my $right = @old-nodes.shift // "*"; $right = Nil if $right eq "*";
+
+ @new-nodes.push(BinaryNode2.new(value => $value.Int,
+ left => $left // Nil,
+ right => $right // Nil));
+ }
+ }
+
+ return @new-nodes[0];
+}
+
+method graph
+{
+ say 'digraph foogrph {';
+ say ' node [shape = record,height=.1];';
+
+ do-it(self);
+
+ say '}';
+
+ sub do-it ($current)
+ {
+ say " node{ $current.value }[label = \"<left> |<center> { $current.value }|<right> \"];";
+
+ if $current.left.defined
+ {
+ say " \"node{ $current.value }\":left -> \"node{ $current.left.value }\":center;";
+ do-it($current.left);
+ }
+
+ if $current.right.defined
+ {
+ say " \"node{ $current.value }\":right -> \"node{ $current.right.value }\":center;";
+ do-it($current.right);
+ }
+ }
+}
+
+method is-bst(:$verbose)
+{
+ try
+ {
+ CATCH
+ {
+ return False;
+ }
+ self.min-max(:$verbose);
+
+ return True;
+ }
+}
+
+method min-max(:$verbose)
+{
+ my ($left_min, $left_max) = self.left ?? self.left.min-max(:$verbose) !! (self.value, self.value);
+ my ($right_min, $right_max) = self.right ?? self.right.min-max(:$verbose) !! (self.value, self.value);
+
+ say ": Node: { self.value } : Left min: $left_min, max: $left_max | Right min: $right_min, max: $right_max" if $verbose;
+
+ die "Not BST" if $left_max > self.value || $right_min < self.value;
+
+ return ( min($left_min, $right_min, self.value), max($left_max, $right_max, self.value) );
+}
diff --git a/challenge-130/arne-sommer/raku/odd-number b/challenge-130/arne-sommer/raku/odd-number
new file mode 100755
index 0000000000..9ad249ea05
--- /dev/null
+++ b/challenge-130/arne-sommer/raku/odd-number
@@ -0,0 +1,15 @@
+#! /usr/bin/env raku
+
+unit sub MAIN ($numbers = "2 5 4 4 5 5 2");
+
+my @numbers = $numbers.words;
+
+die "Positive integers only" unless all(@numbers) ~~ /^<[1..9]>\d*$/;
+
+my %count = @numbers.Bag;
+
+my @odd = %count.keys.grep({ %count{$_} % 2 });
+
+die "Did not find one (and only one) match. Found: { @odd ?? @odd.join(", ") !! 'none' }" if @odd.elems != 1;
+
+say @odd[0];