aboutsummaryrefslogtreecommitdiff
path: root/challenge-228
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2023-08-01 00:30:26 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2023-08-01 00:30:26 +0100
commitb7c6ba230d95ffad246f0f9874e82cbd95e12f56 (patch)
treec4ba4a2568676aba47a13dba8dcd5ea206366461 /challenge-228
parentb7b0353c40a650fce3847d239aa83c2eb67086ac (diff)
downloadperlweeklychallenge-club-b7c6ba230d95ffad246f0f9874e82cbd95e12f56.tar.gz
perlweeklychallenge-club-b7c6ba230d95ffad246f0f9874e82cbd95e12f56.tar.bz2
perlweeklychallenge-club-b7c6ba230d95ffad246f0f9874e82cbd95e12f56.zip
- Added solutions by Niels van Dijke.
- Added solutions by Ulrich Rieke. - Added solutions by Robert DiCicco. - Added solutions by Laurent Rosenfeld. - Added solutions by Peter Meszaros. - Added solutions by Mark Anderson. - Added solutions by Lubos Kolouch. - Added solutions by Ali Moradi. - Added solutions by Dave Jacoby. - Added solutions by Peter Campbell Smith. - Added solutions by W. Luis Mochan. - Added solutions by Steven Wilson. - Added solutions by Thomas Kohler. - Added solutions by E. Choroba. - Added solutions by Bob Lied.
Diffstat (limited to 'challenge-228')
-rw-r--r--challenge-228/conor-hoekstra/apl/ch-1.apl (renamed from challenge-228/conor-hoekstra/ch-01.apl)0
-rw-r--r--challenge-228/conor-hoekstra/bqn/ch-1.bqn (renamed from challenge-228/conor-hoekstra/ch-01.bqn)0
-rw-r--r--challenge-228/conor-hoekstra/python/ch-1.py (renamed from challenge-228/conor-hoekstra/ch-01.py)0
-rw-r--r--challenge-228/conor-hoekstra/rust/ch-1.rs (renamed from challenge-228/conor-hoekstra/ch-01.rs)0
-rwxr-xr-xchallenge-228/eric-cheung/python/ch-1.py8
-rwxr-xr-xchallenge-228/eric-cheung/python/ch-2.py13
-rw-r--r--challenge-228/laurent-rosenfeld/blog.txt1
-rw-r--r--challenge-228/laurent-rosenfeld/perl/ch-1.pl17
-rw-r--r--challenge-228/laurent-rosenfeld/raku/ch-1.raku10
-rwxr-xr-xchallenge-228/perlboy1967/perl/ch-1.pl (renamed from challenge-228/perlboy1967/perl/ch1.pl)0
-rwxr-xr-xchallenge-228/perlboy1967/perl/ch-2.pl (renamed from challenge-228/perlboy1967/perl/ch2.pl)0
-rw-r--r--challenge-228/robert-dicicco/julia/ch-1.jl68
-rw-r--r--challenge-228/robert-dicicco/perl/ch-1.pl62
-rw-r--r--challenge-228/robert-dicicco/raku/ch-1.raku57
-rw-r--r--challenge-228/robert-dicicco/ruby/ch-1.rb63
-rw-r--r--challenge-228/steven-wilson/perl/ch-1.pl (renamed from challenge-228/steven-wilson/perl/ch-01.pl)0
-rw-r--r--challenge-228/steven-wilson/perl/ch-2.pl (renamed from challenge-228/steven-wilson/perl/ch-02.pl)0
-rwxr-xr-xchallenge-228/ulrich-rieke/cpp/ch-1.cpp35
-rwxr-xr-xchallenge-228/ulrich-rieke/cpp/ch-2.cpp45
-rwxr-xr-xchallenge-228/ulrich-rieke/haskell/ch-1.hs8
-rwxr-xr-xchallenge-228/ulrich-rieke/haskell/ch-2.hs21
-rwxr-xr-xchallenge-228/ulrich-rieke/perl/ch-1.pl23
-rwxr-xr-xchallenge-228/ulrich-rieke/perl/ch-2.pl34
-rwxr-xr-xchallenge-228/ulrich-rieke/raku/ch-1.raku10
-rwxr-xr-xchallenge-228/ulrich-rieke/raku/ch-2.raku27
-rwxr-xr-xchallenge-228/ulrich-rieke/rust/ch-1.rs23
-rwxr-xr-xchallenge-228/ulrich-rieke/rust/ch-2.rs23
27 files changed, 548 insertions, 0 deletions
diff --git a/challenge-228/conor-hoekstra/ch-01.apl b/challenge-228/conor-hoekstra/apl/ch-1.apl
index ad2c531256..ad2c531256 100644
--- a/challenge-228/conor-hoekstra/ch-01.apl
+++ b/challenge-228/conor-hoekstra/apl/ch-1.apl
diff --git a/challenge-228/conor-hoekstra/ch-01.bqn b/challenge-228/conor-hoekstra/bqn/ch-1.bqn
index 060ee089ec..060ee089ec 100644
--- a/challenge-228/conor-hoekstra/ch-01.bqn
+++ b/challenge-228/conor-hoekstra/bqn/ch-1.bqn
diff --git a/challenge-228/conor-hoekstra/ch-01.py b/challenge-228/conor-hoekstra/python/ch-1.py
index 28b58a09e6..28b58a09e6 100644
--- a/challenge-228/conor-hoekstra/ch-01.py
+++ b/challenge-228/conor-hoekstra/python/ch-1.py
diff --git a/challenge-228/conor-hoekstra/ch-01.rs b/challenge-228/conor-hoekstra/rust/ch-1.rs
index be2eb5b2c2..be2eb5b2c2 100644
--- a/challenge-228/conor-hoekstra/ch-01.rs
+++ b/challenge-228/conor-hoekstra/rust/ch-1.rs
diff --git a/challenge-228/eric-cheung/python/ch-1.py b/challenge-228/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..ae4d0ec1d9
--- /dev/null
+++ b/challenge-228/eric-cheung/python/ch-1.py
@@ -0,0 +1,8 @@
+
+## arrInt = [2, 1, 3, 2] ## Example 1
+## arrInt = [1, 1, 1, 1] ## Example 2
+arrInt = [2, 1, 3, 4] ## Example 3
+
+arrUniqInt = [nLoop for nLoop in list(set(arrInt)) if arrInt.count(nLoop) == 1]
+
+print (sum(arrUniqInt))
diff --git a/challenge-228/eric-cheung/python/ch-2.py b/challenge-228/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..6f74b418c1
--- /dev/null
+++ b/challenge-228/eric-cheung/python/ch-2.py
@@ -0,0 +1,13 @@
+
+## arrInt = [3, 4, 2] ## Example 1
+arrInt = [1, 2, 3] ## Example 2
+
+nCount = 0
+
+while len(arrInt) > 0:
+ if arrInt[0] > min(arrInt):
+ arrInt.append(arrInt[0])
+ del arrInt[0]
+ nCount = nCount + 1
+
+print (nCount)
diff --git a/challenge-228/laurent-rosenfeld/blog.txt b/challenge-228/laurent-rosenfeld/blog.txt
new file mode 100644
index 0000000000..b441e51a67
--- /dev/null
+++ b/challenge-228/laurent-rosenfeld/blog.txt
@@ -0,0 +1 @@
+https://blogs.perl.org/users/laurent_r/2023/07/perl-weekly-challenge-228-unique-sum.html
diff --git a/challenge-228/laurent-rosenfeld/perl/ch-1.pl b/challenge-228/laurent-rosenfeld/perl/ch-1.pl
new file mode 100644
index 0000000000..d146cfeb85
--- /dev/null
+++ b/challenge-228/laurent-rosenfeld/perl/ch-1.pl
@@ -0,0 +1,17 @@
+use strict;
+use warnings;
+use feature 'say';
+
+sub unique_sum {
+ my %histo; # histogram
+ $histo{$_}++ for @_;
+ my @unique = grep { $histo{$_} == 1 } keys %histo;
+ my $sum = 0;
+ $sum += $_ for @unique;
+ return $sum;
+}
+
+for my $test ([2, 1, 3, 2], [1, 1, 1, 1], [2, 1, 3, 4]) {
+ printf "%-10s => ", "@$test";
+ say unique_sum @$test;
+}
diff --git a/challenge-228/laurent-rosenfeld/raku/ch-1.raku b/challenge-228/laurent-rosenfeld/raku/ch-1.raku
new file mode 100644
index 0000000000..5ed2411537
--- /dev/null
+++ b/challenge-228/laurent-rosenfeld/raku/ch-1.raku
@@ -0,0 +1,10 @@
+sub unique-sum (@in) {
+ my $histo = @in.Bag; # histogram
+ my @unique = grep { $histo{$_} == 1 }, $histo.keys;
+ return [+] @unique;
+}
+
+for (2, 1, 3, 2), (1, 1, 1, 1), (2, 1, 3, 4) -> @test {
+ printf "%-10s => ", "@test[]";
+ say unique-sum @test;
+}
diff --git a/challenge-228/perlboy1967/perl/ch1.pl b/challenge-228/perlboy1967/perl/ch-1.pl
index 371fc09cc2..371fc09cc2 100755
--- a/challenge-228/perlboy1967/perl/ch1.pl
+++ b/challenge-228/perlboy1967/perl/ch-1.pl
diff --git a/challenge-228/perlboy1967/perl/ch2.pl b/challenge-228/perlboy1967/perl/ch-2.pl
index 0dd250f875..0dd250f875 100755
--- a/challenge-228/perlboy1967/perl/ch2.pl
+++ b/challenge-228/perlboy1967/perl/ch-2.pl
diff --git a/challenge-228/robert-dicicco/julia/ch-1.jl b/challenge-228/robert-dicicco/julia/ch-1.jl
new file mode 100644
index 0000000000..9a6e07a338
--- /dev/null
+++ b/challenge-228/robert-dicicco/julia/ch-1.jl
@@ -0,0 +1,68 @@
+#/usr/bin/env julia
+#=
+-----------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-07-31
+Challenge 228 Task 1 Unique Sum ( Julia )
+-----------------------------------------
+=#
+
+using Printf
+
+myints = [[2, 1, 3, 2],[1, 1, 1, 1],[2, 1, 3, 4]]
+
+hash = Dict()
+
+function CreateHash(h)
+ ln = length(h)
+ cnt = 1
+ while cnt <= ln
+ hkey = h[cnt]
+ hash[hkey] = 0
+ cnt += 1
+ end
+ cnt = 1
+ while cnt <= ln
+ hkey = h[cnt]
+ hash[hkey] += 1
+ cnt += 1
+ end
+end
+
+function FindUniqueSum()
+ global hash
+ flag = 0
+ sum = 0
+ for (key, value) in hash
+ if hash[key] == 1
+ sum += key
+ end
+ end
+ @printf("Output: %d\n\n",sum)
+end
+
+for h in myints
+ global hash
+ @printf("Input: @int = %s\n", h)
+ CreateHash(h)
+ FindUniqueSum()
+ hash = Dict()
+end
+
+#=
+-----------------------------------------
+SAMPLE OUTPUT
+julia .\UniqueSum.jl
+
+Input: @int = [2, 1, 3, 2]
+Output: 4
+
+Input: @int = [1, 1, 1, 1]
+Output: 0
+
+Input: @int = [2, 1, 3, 4]
+Output: 10
+-----------------------------------------
+=#
+
+
diff --git a/challenge-228/robert-dicicco/perl/ch-1.pl b/challenge-228/robert-dicicco/perl/ch-1.pl
new file mode 100644
index 0000000000..a293e5f2a5
--- /dev/null
+++ b/challenge-228/robert-dicicco/perl/ch-1.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/env perl
+=begin commnt
+-----------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-07-31
+Challenge 228 Task 1 Unique Sum ( Perl )
+-----------------------------------------
+=cut
+use v5.38;
+
+my %hash;
+
+my @ints = ([2, 1, 3, 2],[1, 1, 1, 1],[2, 1, 3, 4]);
+
+sub CreateHashValues($h) {
+ %hash = ();
+ my $ln = scalar(@$h);
+ my $cnt = 0;
+ while ($cnt < scalar @$h) {
+ if(! exists $hash{$h->[$cnt]}) {
+ $hash{$h->[$cnt]} = 1;
+ } else {
+ $hash{$h->[$cnt]}++;
+ }
+ $cnt++;
+ }
+}
+
+
+sub FindUniqueSum() {
+ my $flag = 0;
+ my $sum = 0;
+ for my $key (keys %hash) {
+ $sum += $key if ($hash{$key} == 1);
+ }
+ say "Output: ",$sum,"\n";
+ %hash = ();
+}
+
+for my $x (@ints) {
+ say "Input: \@int = [@$x]";
+ CreateHashValues(\@$x);
+ FindUniqueSum;
+ }
+
+=begin commnt
+-----------------------------------------
+SAMPLE OUTPUT
+perl .\UniqueSum.pl
+
+Input: @int = [2 1 3 2]
+Output: 4
+
+Input: @int = [1 1 1 1]
+Output: 0
+
+Input: @int = [2 1 3 4]
+Output: 10
+-----------------------------------------
+=cut
+
+
diff --git a/challenge-228/robert-dicicco/raku/ch-1.raku b/challenge-228/robert-dicicco/raku/ch-1.raku
new file mode 100644
index 0000000000..79f4c88bc1
--- /dev/null
+++ b/challenge-228/robert-dicicco/raku/ch-1.raku
@@ -0,0 +1,57 @@
+#!/usr/bin/env raku
+=begin comment
+-----------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-07-31
+Challenge 228 Task 1 Unique Sum ( Raku )
+-----------------------------------------
+=end comment
+use v6;
+
+my %hash;
+
+my @ints = ([2, 1, 3, 2],[1, 1, 1, 1],[2, 1, 3, 4]);
+
+sub CreateHashValues(@h) {
+ %hash = ();
+ my $ln = @h.elems;
+ my $cnt = 0;
+ while $cnt < $ln {
+ %hash{@h[$cnt]} += 1;
+ $cnt++;
+ }
+}
+
+sub FindUniqueSum() {
+ my $flag = 0;
+ my $sum = 0;
+ for (keys %hash) -> $key {
+ $sum += $key if (%hash{$key} == 1);
+ }
+ say "Output: ",$sum,"\n";
+ %hash = ();
+}
+
+for (@ints) -> @h {
+ say "Input: \@int = ",@h;
+ CreateHashValues(@h);
+ FindUniqueSum();
+}
+
+=begin comment
+-----------------------------------------
+SAMPLE OUTPUT
+raku .\UniqueSum.rk
+
+Input: @int = [2 1 3 2]
+Output: 4
+
+Input: @int = [1 1 1 1]
+Output: 0
+
+Input: @int = [2 1 3 4]
+Output: 10
+-----------------------------------------
+=end comment
+
+
diff --git a/challenge-228/robert-dicicco/ruby/ch-1.rb b/challenge-228/robert-dicicco/ruby/ch-1.rb
new file mode 100644
index 0000000000..2dbabf2dcf
--- /dev/null
+++ b/challenge-228/robert-dicicco/ruby/ch-1.rb
@@ -0,0 +1,63 @@
+#!/usr/bin/env ruby
+=begin
+-----------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-07-31
+Challenge 228 Task 1 Unique Sum ( Ruby )
+-----------------------------------------
+=end
+
+myints = [[2, 1, 3, 2],[1, 1, 1, 1],[2, 1, 3, 4]]
+
+$hash = Hash.new
+
+def CreateHash(h)
+ $hash.clear()
+ ln = h.length()
+ cnt = 0
+ while cnt < ln
+ hkey = h[cnt]
+ $hash[hkey] = 0
+ cnt += 1
+ end
+ cnt = 0
+ while cnt < ln
+ hkey = h[cnt]
+ $hash[hkey] += 1
+ cnt += 1
+ end
+end
+
+def FindUniqueSum()
+ flag = 0
+ sum = 0;
+ $hash.each do |key,value|
+ sum += key if $hash[key] == 1
+ end
+ puts("Output: #{sum}\n\n");
+end
+
+
+myints.each do |h|
+ puts("Input: @int = #{h}")
+ CreateHash(h)
+ FindUniqueSum()
+end
+
+=begin
+-----------------------------------------
+SAMPLE OUTPUT
+ruby .\UniqueSum.rb
+
+Input: @int = [2, 1, 3, 2]
+Output: 4
+
+Input: @int = [1, 1, 1, 1]
+Output: 0
+
+Input: @int = [2, 1, 3, 4]
+Output: 10
+-----------------------------------------
+=end
+
+
diff --git a/challenge-228/steven-wilson/perl/ch-01.pl b/challenge-228/steven-wilson/perl/ch-1.pl
index dae4b4e6ba..dae4b4e6ba 100644
--- a/challenge-228/steven-wilson/perl/ch-01.pl
+++ b/challenge-228/steven-wilson/perl/ch-1.pl
diff --git a/challenge-228/steven-wilson/perl/ch-02.pl b/challenge-228/steven-wilson/perl/ch-2.pl
index 17b0e0689e..17b0e0689e 100644
--- a/challenge-228/steven-wilson/perl/ch-02.pl
+++ b/challenge-228/steven-wilson/perl/ch-2.pl
diff --git a/challenge-228/ulrich-rieke/cpp/ch-1.cpp b/challenge-228/ulrich-rieke/cpp/ch-1.cpp
new file mode 100755
index 0000000000..106d4ee20f
--- /dev/null
+++ b/challenge-228/ulrich-rieke/cpp/ch-1.cpp
@@ -0,0 +1,35 @@
+#include <iostream>
+#include <vector>
+#include <string>
+#include <numeric>
+#include <algorithm>
+
+std::vector<std::string> split( const std::string & startline ,
+ const std::string & sep ) {
+ std::vector<std::string> separated ;
+ std::string::size_type start { 0 } ;
+ std::string::size_type pos ;
+ do {
+ pos = startline.find_first_of( sep , start ) ;
+ separated.push_back( startline.substr(start , pos - start )) ;
+ start = pos + 1 ;
+ } while ( pos != std::string::npos ) ;
+ return separated ;
+}
+
+int main( ) {
+ std::cout << "Enter some integers, separated by blanks!\n" ;
+ std::string line ;
+ std::getline( std::cin , line ) ;
+ std::vector<std::string> numberstrings ( split( line , " " ) ) ;
+ std::vector<int> numbers ;
+ for ( auto s : numberstrings )
+ numbers.push_back( std::stoi( s ) ) ;
+ std::vector<int> uniques ;
+ for ( int i : numbers ) {
+ if ( std::count( numbers.begin( ) , numbers.end( ) , i ) == 1 )
+ uniques.push_back( i ) ;
+ }
+ std::cout << std::accumulate( uniques.begin( ) , uniques.end( ) , 0 ) << std::endl ;
+ return 0 ;
+}
diff --git a/challenge-228/ulrich-rieke/cpp/ch-2.cpp b/challenge-228/ulrich-rieke/cpp/ch-2.cpp
new file mode 100755
index 0000000000..8b228dff22
--- /dev/null
+++ b/challenge-228/ulrich-rieke/cpp/ch-2.cpp
@@ -0,0 +1,45 @@
+#include <iostream>
+#include <string>
+#include <list>
+#include <vector>
+#include <algorithm>
+
+std::vector<std::string> split( const std::string & startline ,
+ const std::string & sep ) {
+ std::vector<std::string> separated ;
+ std::string::size_type start { 0 } ;
+ std::string::size_type pos ;
+ do {
+ pos = startline.find_first_of( sep , start ) ;
+ separated.push_back( startline.substr(start , pos - start )) ;
+ start = pos + 1 ;
+ } while ( pos != std::string::npos ) ;
+ return separated ;
+}
+
+int main( ) {
+ std::cout << "Enter some unique integers, separated by blanks!\n" ;
+ std::string line ;
+ std::getline( std::cin , line ) ;
+ std::vector<std::string> numberstrings ( split ( line , " " ) ) ;
+ std::list<int> numbers ;
+ for ( auto s : numberstrings )
+ numbers.push_back( std::stoi( s ) ) ;
+ int rounds = 0 ;
+ while ( numbers.size( ) > 0 ) {
+ //look for the smallest element
+ int mini = *std::min_element( numbers.begin( ) , numbers.end( ) ) ;
+ auto pos = std::find( numbers.begin( ) , numbers.end( ) , mini ) ;
+ if ( pos == numbers.begin( ) ) //if the smallest element is at the start
+ //of list numbers
+ numbers.remove( mini ) ; //remove it
+ else {
+ int first = *numbers.begin( ) ; //save the first element
+ numbers.pop_front( ) ;
+ numbers.push_back( first ) ; //and push it at the end of the vector
+ }
+ rounds++ ;
+ }
+ std::cout << rounds << std::endl ;
+ return 0 ;
+}
diff --git a/challenge-228/ulrich-rieke/haskell/ch-1.hs b/challenge-228/ulrich-rieke/haskell/ch-1.hs
new file mode 100755
index 0000000000..9acf9b4a89
--- /dev/null
+++ b/challenge-228/ulrich-rieke/haskell/ch-1.hs
@@ -0,0 +1,8 @@
+module Challenge228
+ where
+
+count :: Eq a => [a] -> a -> Int
+count list element = length $ filter ( == element ) list
+
+solution :: [Int] -> Int
+solution list = sum $ filter ( (== 1 ) . count list ) list
diff --git a/challenge-228/ulrich-rieke/haskell/ch-2.hs b/challenge-228/ulrich-rieke/haskell/ch-2.hs
new file mode 100755
index 0000000000..df2f53c9a1
--- /dev/null
+++ b/challenge-228/ulrich-rieke/haskell/ch-2.hs
@@ -0,0 +1,21 @@
+module Challenge228_2
+ where
+import Data.List ( findIndex )
+
+solution :: [Int] -> Int
+solution list = fst $ until ( null . snd ) step (0 , list)
+ where
+ step :: (Int , [Int]) -> (Int , [Int] )
+ step ( aNum , aList ) = (aNum + 1 , if (findIndex ( == mini ) aList ) == Just 0
+ then tail aList else tail aList ++ [head aList] )
+ where
+ mini :: Int
+ mini = minimum aList
+
+main :: IO ( )
+main = do
+ putStrLn "Enter some unique integers, separated by blanks!"
+ numberstrings <- getLine
+ let numbers = map read $ words numberstrings
+ print $ solution numbers
+
diff --git a/challenge-228/ulrich-rieke/perl/ch-1.pl b/challenge-228/ulrich-rieke/perl/ch-1.pl
new file mode 100755
index 0000000000..ece4f0898e
--- /dev/null
+++ b/challenge-228/ulrich-rieke/perl/ch-1.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+use List::Util qw ( sum ) ;
+
+sub count {
+ my $haystack = shift ;
+ my $needle = shift ;
+ return scalar( grep { $_ == $needle } @$haystack ) ;
+}
+
+say "Enter some integers, separated by blanks!" ;
+my $line = <STDIN> ;
+chomp $line ;
+my @numbers = split( /\s/ , $line ) ;
+my @selected = grep { count( \@numbers , $_ ) == 1 } @numbers ;
+if ( @selected ) {
+ say sum( @selected ) ;
+}
+else {
+ say 0 ;
+}
diff --git a/challenge-228/ulrich-rieke/perl/ch-2.pl b/challenge-228/ulrich-rieke/perl/ch-2.pl
new file mode 100755
index 0000000000..2851712f59
--- /dev/null
+++ b/challenge-228/ulrich-rieke/perl/ch-2.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+use List::Util qw ( min ) ;
+
+sub findIndex {
+ my $array = shift ;
+ my $needle = shift ;
+ my $pos = 0 ;
+ while ( $array->[$pos] != $needle ) {
+ $pos++ ;
+ }
+ return $pos ;
+}
+
+say "Enter some unique integers, separated by blanks!" ;
+my $line = <STDIN> ;
+chomp $line ;
+my @numbers = split( /\s/ , $line ) ;
+my $rounds = 0 ;
+while ( scalar( @numbers ) > 0 ) {
+ my $mini = min( @numbers ) ;
+ my $pos = findIndex( \@numbers , $mini ) ;
+ my $num = shift @numbers ;
+ if ( $pos == 0 ) {
+ }
+ else {
+ push @numbers , $num ;
+ }
+ $rounds++ ;
+}
+say $rounds ;
+
diff --git a/challenge-228/ulrich-rieke/raku/ch-1.raku b/challenge-228/ulrich-rieke/raku/ch-1.raku
new file mode 100755
index 0000000000..4e9720bb55
--- /dev/null
+++ b/challenge-228/ulrich-rieke/raku/ch-1.raku
@@ -0,0 +1,10 @@
+use v6 ;
+
+sub count( @haystack , $needle ) {
+ return @haystack.grep( { $_ == $needle} ).elems ;
+}
+
+say "Enter some integers, separated by blanks!" ;
+my $line = $*IN.get ;
+my @numbers = $line.words.map( {.Int} ) ;
+say @numbers.grep( { count( @numbers , $_ ) == 1 } ).sum ;
diff --git a/challenge-228/ulrich-rieke/raku/ch-2.raku b/challenge-228/ulrich-rieke/raku/ch-2.raku
new file mode 100755
index 0000000000..9a850028c0
--- /dev/null
+++ b/challenge-228/ulrich-rieke/raku/ch-2.raku
@@ -0,0 +1,27 @@
+use v6 ;
+
+sub findIndex( @array , $needle ) {
+ my $pos = 0 ;
+ while ( @array[ $pos ] != $needle ) {
+ $pos++ ;
+ }
+ return $pos ;
+}
+
+say "Enter some unique integers, separated by blanks!" ;
+my $line = $*IN.get ;
+my @numbers = $line.words.map( {.Int} ) ;
+my $rounds = 0 ;
+while ( @numbers.elems > 0 ) {
+ my $mini = @numbers.min( ) ;
+ my $pos = findIndex( @numbers , $mini ) ;
+ my $num = @numbers.shift ;
+ if ( $pos == 0 ) {
+ }
+ else {
+ @numbers.push( $num ) ;
+ }
+ $rounds++ ;
+}
+say $rounds ;
+
diff --git a/challenge-228/ulrich-rieke/rust/ch-1.rs b/challenge-228/ulrich-rieke/rust/ch-1.rs
new file mode 100755
index 0000000000..defc88b5bf
--- /dev/null
+++ b/challenge-228/ulrich-rieke/rust/ch-1.rs
@@ -0,0 +1,23 @@
+use std::io ;
+
+fn main() {
+ println!("Enter some unique integers, separated by blanks!");
+ let mut inline : String = String::new( ) ;
+ io::stdin( ).read_line( &mut inline ).unwrap( ) ;
+ let entered_line : &str = &*inline ;
+ let mut numbers : Vec<i32> = entered_line.split_whitespace( ).map( | s |
+ s.trim( ).parse::<i32>( ).unwrap( ) ).collect( ) ;
+ let mut rounds : usize = 0 ;
+ while numbers.len( ) > 0 {
+ let mini : i32 = *numbers.iter( ).min( ).unwrap( ) ;
+ let pos : usize = numbers.iter( ).position( | d | *d == mini ).unwrap( ) ;
+ let i : i32 = numbers.remove( 0 ) ;
+ if pos == 0 {
+ }
+ else {
+ numbers.push( i ) ;
+ }
+ rounds += 1 ;
+ }
+ println!("{}" , rounds ) ;
+}
diff --git a/challenge-228/ulrich-rieke/rust/ch-2.rs b/challenge-228/ulrich-rieke/rust/ch-2.rs
new file mode 100755
index 0000000000..defc88b5bf
--- /dev/null
+++ b/challenge-228/ulrich-rieke/rust/ch-2.rs
@@ -0,0 +1,23 @@
+use std::io ;
+
+fn main() {
+ println!("Enter some unique integers, separated by blanks!");
+ let mut inline : String = String::new( ) ;
+ io::stdin( ).read_line( &mut inline ).unwrap( ) ;
+ let entered_line : &str = &*inline ;
+ let mut numbers : Vec<i32> = entered_line.split_whitespace( ).map( | s |
+ s.trim( ).parse::<i32>( ).unwrap( ) ).collect( ) ;
+ let mut rounds : usize = 0 ;
+ while numbers.len( ) > 0 {
+ let mini : i32 = *numbers.iter( ).min( ).unwrap( ) ;
+ let pos : usize = numbers.iter( ).position( | d | *d == mini ).unwrap( ) ;
+ let i : i32 = numbers.remove( 0 ) ;
+ if pos == 0 {
+ }
+ else {
+ numbers.push( i ) ;
+ }
+ rounds += 1 ;
+ }
+ println!("{}" , rounds ) ;
+}