aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-211/eric-cheung/python/ch-1.py17
-rwxr-xr-xchallenge-211/eric-cheung/python/ch-2.py64
-rw-r--r--challenge-211/robert-dicicco/julia/ch-2.jl82
-rw-r--r--challenge-211/robert-dicicco/python/ch-2.py71
-rw-r--r--challenge-211/robert-dicicco/raku/ch-2.raku41
-rw-r--r--challenge-211/robert-dicicco/ruby/ch-2.rb65
-rw-r--r--challenge-211/ulrich-rieke/cpp/ch-1.cpp48
-rw-r--r--challenge-211/ulrich-rieke/haskell/ch-1.hs10
-rw-r--r--challenge-211/ulrich-rieke/haskell/ch-2.hs32
-rw-r--r--challenge-211/ulrich-rieke/perl/ch-1.pl28
-rw-r--r--challenge-211/ulrich-rieke/perl/ch-2.pl78
-rw-r--r--challenge-211/ulrich-rieke/raku/ch-1.raku22
-rw-r--r--challenge-211/ulrich-rieke/rust/ch-2.rs83
-rw-r--r--stats/pwc-challenge-210.json611
-rw-r--r--stats/pwc-current.json587
-rw-r--r--stats/pwc-language-breakdown-summary.json70
-rw-r--r--stats/pwc-language-breakdown.json2973
-rw-r--r--stats/pwc-leaders.json468
-rw-r--r--stats/pwc-summary-1-30.json32
-rw-r--r--stats/pwc-summary-121-150.json48
-rw-r--r--stats/pwc-summary-151-180.json110
-rw-r--r--stats/pwc-summary-181-210.json108
-rw-r--r--stats/pwc-summary-211-240.json60
-rw-r--r--stats/pwc-summary-241-270.json104
-rw-r--r--stats/pwc-summary-271-300.json76
-rw-r--r--stats/pwc-summary-31-60.json54
-rw-r--r--stats/pwc-summary-61-90.json48
-rw-r--r--stats/pwc-summary-91-120.json52
-rw-r--r--stats/pwc-summary.json646
29 files changed, 3819 insertions, 2869 deletions
diff --git a/challenge-211/eric-cheung/python/ch-1.py b/challenge-211/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..2376aa66d7
--- /dev/null
+++ b/challenge-211/eric-cheung/python/ch-1.py
@@ -0,0 +1,17 @@
+
+## arrMatrixInput = [[4, 3, 2, 1], [5, 4, 3, 2], [6, 5, 4, 3]] ## Example 1
+arrMatrixInput = [[1, 2, 3], [3, 2, 1]] ## Example 2
+
+nMatrixRow = len(arrMatrixInput)
+nMatrixCol = len(arrMatrixInput[0])
+
+nMinIndx = min(nMatrixRow, nMatrixCol)
+
+bIsToeplitzMatrix = True
+nDiagElem = arrMatrixInput[0][0]
+for nIndxLoop in range(1, nMinIndx):
+ if arrMatrixInput[nIndxLoop][nIndxLoop] != nDiagElem:
+ bIsToeplitzMatrix = False
+ break
+
+print (bIsToeplitzMatrix)
diff --git a/challenge-211/eric-cheung/python/ch-2.py b/challenge-211/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..20c7925e9f
--- /dev/null
+++ b/challenge-211/eric-cheung/python/ch-2.py
@@ -0,0 +1,64 @@
+
+## Remarks
+## https://github.com/ChiahungTai/LeetCode/blob/master/Python/split-array-with-same-average.py
+
+
+## Time: O(n^4)
+## Space: O(n^3)
+
+## In a given integer array A, we must move every element of A to
+## either list B or list C. (B and C initially start empty.)
+##
+## Return true if and only if after such a move, it is possible that
+## the average value of B is equal to the average value of C, and B and C are both non-empty.
+##
+## Example :
+## Input:
+## [1, 2, 3, 4, 5, 6, 7, 8]
+## Output: true
+## Explanation: We can split the array into [1, 4, 5, 8] and [2, 3, 6, 7],
+## and both of them have the average of 4.5.
+##
+## Note:
+## - The length of A will be in the range [1, 30].
+## - A[i] will be in the range of [0, 10000].
+
+class Solution(object):
+
+ def splitArraySameAverage(self, A):
+ """
+ :type A: List[int]
+ :rtype: bool
+ """
+ def possible(total, n):
+ for i in range(1, n // 2 + 1):
+ if total * i % n == 0:
+ return True
+
+ return False
+
+ n, s = len(A), sum(A)
+
+ if not possible(n, s):
+ return False
+
+ sums = [set() for _ in range(n // 2 + 1)];
+ sums[0].add(0)
+
+ for num in A: # O(n) times
+ for i in reversed(range(1, n // 2 + 1)): ## O(n) times
+ for prev in sums[i - 1]: ## O(1) + O(2) + ... O(n/2) = O(n^2) times
+ sums[i].add(prev + num)
+
+ for i in range(1, n // 2 + 1):
+ if s * i % n == 0 and s * i // n in sums[i]:
+ return True
+
+ return False
+
+
+## arrInput = [1, 2, 3, 4, 5, 6, 7, 8] ## Example 1
+arrInput = [1, 3] ## Example 2
+
+objVar = Solution()
+print (objVar.splitArraySameAverage(arrInput))
diff --git a/challenge-211/robert-dicicco/julia/ch-2.jl b/challenge-211/robert-dicicco/julia/ch-2.jl
new file mode 100644
index 0000000000..f6ea325576
--- /dev/null
+++ b/challenge-211/robert-dicicco/julia/ch-2.jl
@@ -0,0 +1,82 @@
+#!/usr/bin/env julia
+#=
+----------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-04-04
+Challenge 211 Split Same Average ( Julia )
+----------------------------------------
+=#
+using Printf
+using Combinatorics
+
+nums = [1,2,3,4,5,6,7,8]
+#nums = [1,3]
+
+flag = 0;
+sec_arr = []
+
+for ndx in 1:5
+@printf("Set Size = %d\n", ndx)
+@printf("Input: @nums = %s\n",nums)
+mycheck = false
+Set1 = Set(nums)
+
+for s2 in combinations(nums,ndx)
+ global flag
+ Set2 = Set(s2)
+ Set3 = setdiff(Set1, Set2)
+ x = reduce(+, Set3)
+ y = reduce(+, Set2)
+ if x/length(Set3) == y/length(Set2)
+ println("\t",Set2,' ',Set3)
+ flag = 1
+ end
+end
+
+if flag == 1
+ println("Output: true\n")
+else
+ println("Output: false\n")
+end
+global flag = 0
+end
+
+#=
+----------------------------------------
+SAMPLE OUTPUT
+julia .\SplitSame.jl
+Set Size = 1
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+Output: false
+
+Set Size = 2
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+ Set([8, 1]) Set([5, 4, 6, 7, 2, 3])
+ Set([7, 2]) Set([5, 4, 6, 8, 3, 1])
+ Set([6, 3]) Set([5, 4, 7, 2, 8, 1])
+ Set([5, 4]) Set([6, 7, 2, 8, 3, 1])
+Output: true
+
+Set Size = 3
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+Output: false
+
+Set Size = 4
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+ Set([7, 2, 8, 1]) Set([5, 4, 6, 3])
+ Set([6, 8, 3, 1]) Set([5, 4, 7, 2])
+ Set([5, 4, 8, 1]) Set([6, 7, 2, 3])
+ Set([4, 6, 7, 1]) Set([5, 2, 8, 3])
+ Set([5, 2, 8, 3]) Set([4, 6, 7, 1])
+ Set([6, 7, 2, 3]) Set([5, 4, 8, 1])
+ Set([5, 4, 7, 2]) Set([6, 8, 3, 1])
+ Set([5, 4, 6, 3]) Set([7, 2, 8, 1])
+Output: true
+
+Set Size = 5
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+Output: false
+----------------------------------------
+=#
+
+
diff --git a/challenge-211/robert-dicicco/python/ch-2.py b/challenge-211/robert-dicicco/python/ch-2.py
new file mode 100644
index 0000000000..9da6c150b6
--- /dev/null
+++ b/challenge-211/robert-dicicco/python/ch-2.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+'''
+----------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-04-04
+Challenge 211 Split Same Average ( Python )
+----------------------------------------
+'''
+from itertools import combinations
+import functools
+import operator
+
+nums = [1,2,3,4,5,6,7,8]
+flag = 0
+
+for ndx in range(1,5):
+ print("Set size = ",ndx)
+ print("Input: @nums = ", nums)
+ mycheck = False
+ Set1 = set(nums)
+ for s2 in combinations(Set1,ndx):
+ Set2 = ((s2))
+ Set3 = Set1.difference(Set2)
+ s2 = functools.reduce(operator.add, Set2)/len(Set2)
+ s3 = functools.reduce(operator.add, Set3)/len(Set3)
+ if s2 == s3:
+ print(Set2,' ',Set3,' ',s2,' ',s3)
+ flag = 1
+ print("Output: true") if (flag==1) else print("output: false")
+ flag = 0
+
+ print('')
+
+'''
+----------------------------------------
+SAMPLE OUTPUT
+python .\SplitSame.py
+Set size = 1
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+output: false
+
+Set size = 2
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+(1, 8) {2, 3, 4, 5, 6, 7} 4.5 4.5
+(2, 7) {1, 3, 4, 5, 6, 8} 4.5 4.5
+(3, 6) {1, 2, 4, 5, 7, 8} 4.5 4.5
+(4, 5) {1, 2, 3, 6, 7, 8} 4.5 4.5
+Output: true
+
+Set size = 3
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+output: false
+
+Set size = 4
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+(1, 2, 7, 8) {3, 4, 5, 6} 4.5 4.5
+(1, 3, 6, 8) {2, 4, 5, 7} 4.5 4.5
+(1, 4, 5, 8) {2, 3, 6, 7} 4.5 4.5
+(1, 4, 6, 7) {2, 3, 5, 8} 4.5 4.5
+(2, 3, 5, 8) {1, 4, 6, 7} 4.5 4.5
+(2, 3, 6, 7) {1, 4, 5, 8} 4.5 4.5
+(2, 4, 5, 7) {1, 3, 6, 8} 4.5 4.5
+(3, 4, 5, 6) {1, 2, 7, 8} 4.5 4.5
+Output: true
+----------------------------------------
+
+
+
+'''
+
+
diff --git a/challenge-211/robert-dicicco/raku/ch-2.raku b/challenge-211/robert-dicicco/raku/ch-2.raku
new file mode 100644
index 0000000000..2b267d6935
--- /dev/null
+++ b/challenge-211/robert-dicicco/raku/ch-2.raku
@@ -0,0 +1,41 @@
+#!/usr/bin/env raku
+#`{
+----------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-04-04
+Challenge 211 Split Same Average ( Raku )
+----------------------------------------
+}
+
+my @nums = (1,2,3,4,5,6,7,8);
+
+my $flag = 0;
+
+say "Input: \@nums = ",@nums;
+for @nums.combinations(4) -> @pn {
+ my $first = ([+] @pn) / @pn.elems ;
+ my @sec = @nums.grep(none @pn);
+ my $second = ([+] @sec) / @sec.elems ;
+ if $first == $second { $flag = 1};
+ say "-----> ("~@pn~') ('~@sec~') '~" $first : $second" if $first == $second;
+}
+
+$flag == 1 ?? (say "Output: true") !! (say "Output: false");
+
+#`{
+----------------------------------------
+SAMPLE OUTPUT
+raku .\SplitSame.rk
+Input: @nums = [1 2 3 4 5 6 7 8]
+-----> (1 2 7 8) (3 4 5 6) 4.5 : 4.5
+-----> (1 3 6 8) (2 4 5 7) 4.5 : 4.5
+-----> (1 4 5 8) (2 3 6 7) 4.5 : 4.5
+-----> (1 4 6 7) (2 3 5 8) 4.5 : 4.5
+-----> (2 3 5 8) (1 4 6 7) 4.5 : 4.5
+-----> (2 3 6 7) (1 4 5 8) 4.5 : 4.5
+-----> (2 4 5 7) (1 3 6 8) 4.5 : 4.5
+-----> (3 4 5 6) (1 2 7 8) 4.5 : 4.5
+Output: true
+}
+
+
diff --git a/challenge-211/robert-dicicco/ruby/ch-2.rb b/challenge-211/robert-dicicco/ruby/ch-2.rb
new file mode 100644
index 0000000000..3cc837d77f
--- /dev/null
+++ b/challenge-211/robert-dicicco/ruby/ch-2.rb
@@ -0,0 +1,65 @@
+#!/usr/bin/env ruby
+=begin
+----------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-04-04
+Challenge 211 Split Same Average ( Ruby)
+----------------------------------------
+=end
+
+nums = [1,2,3,4,5,6,7,8];
+
+flag = 0;
+
+puts("Input: @nums = #{nums}")
+puts('')
+$check = false
+
+(1..4).each do |x| # check arrays from 1 to 4 in length
+ puts("x = #{x}:")
+ pn = nums.combination(x).to_a # create an array containing x elements
+ flag = 0
+ pn.each do |p|
+ sec_arr = []
+ nums.each do |v|
+ $check = p.include? v
+ if $check == false
+ sec_arr.push(v)
+ end
+ end
+ first_avg = p.sum / 4.to_f
+ sec_avg = sec_arr.sum / 4.to_f
+ if (first_avg == sec_avg and first_avg > 0 and sec_avg > 0)
+ puts("-----> #{p} #{sec_arr} #{first_avg} : #{sec_avg}")
+ flag = 1
+ end
+ end
+ flag == 1 and $check == true ? puts("{Output: true") : puts("Output: false")
+end
+
+=begin
+----------------------------------------
+SAMPLE OUTPUT
+ruby .\SplitSame.rb
+Input: @nums = [1, 2, 3, 4, 5, 6, 7, 8]
+
+x = 1:
+x = 2:
+x = 3:
+-----> [3, 7, 8] [1, 2, 4, 5, 6] 4.5 : 4.5
+-----> [4, 6, 8] [1, 2, 3, 5, 7] 4.5 : 4.5
+-----> [5, 6, 7] [1, 2, 3, 4, 8] 4.5 : 4.5
+{Output: true
+x = 4:
+-----> [1, 2, 7, 8] [3, 4, 5, 6] 4.5 : 4.5
+-----> [1, 3, 6, 8] [2, 4, 5, 7] 4.5 : 4.5
+-----> [1, 4, 5, 8] [2, 3, 6, 7] 4.5 : 4.5
+-----> [1, 4, 6, 7] [2, 3, 5, 8] 4.5 : 4.5
+-----> [2, 3, 5, 8] [1, 4, 6, 7] 4.5 : 4.5
+-----> [2, 3, 6, 7] [1, 4, 5, 8] 4.5 : 4.5
+-----> [2, 4, 5, 7] [1, 3, 6, 8] 4.5 : 4.5
+-----> [3, 4, 5, 6] [1, 2, 7, 8] 4.5 : 4.5
+{Output: true
+----------------------------------------
+=end
+
diff --git a/challenge-211/ulrich-rieke/cpp/ch-1.cpp b/challenge-211/ulrich-rieke/cpp/ch-1.cpp
new file mode 100644
index 0000000000..9065b6c7f0
--- /dev/null
+++ b/challenge-211/ulrich-rieke/cpp/ch-1.cpp
@@ -0,0 +1,48 @@
+#include <vector>
+#include <string>
+#include <algorithm>
+#include <iostream>
+
+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 matrices with same number of integers, end to end!\n" ;
+ std::string line ;
+ std::vector<std::vector<int>> matrix ;
+ std::vector<int> numberline ;
+ std::getline( std::cin , line ) ;
+ while ( line != "end" ) {
+ std::vector<std::string> numberstrings ( split( line , " " ) ) ;
+ for ( auto s : numberstrings )
+ numberline.push_back( std::stoi( s ) ) ;
+ matrix.push_back( numberline ) ;
+ numberline.clear( ) ;
+ std::cout << "Enter some numbers, end to end!\n" ;
+ std::getline( std::cin , line ) ;
+ }
+ int len = matrix.size( ) ;
+ std::vector<int> diagonals ;
+ for ( int i = 0 ; i < len ; i++ ) {
+ std::vector<int> subline ( *(matrix.begin( ) + i ) ) ;
+ diagonals.push_back( subline[ i ] ) ;
+ }
+ int comparison = *(diagonals.begin( ) ) ;
+ if ( std::all_of( diagonals.begin( ) , diagonals.end( ) , [ comparison ]
+ ( int n ) { return n == comparison ; } ) )
+ std::cout << "true" ;
+ else
+ std::cout << "false" ;
+ std::cout << std::endl ;
+ return 0 ;
+}
diff --git a/challenge-211/ulrich-rieke/haskell/ch-1.hs b/challenge-211/ulrich-rieke/haskell/ch-1.hs
new file mode 100644
index 0000000000..076e5a5c77
--- /dev/null
+++ b/challenge-211/ulrich-rieke/haskell/ch-1.hs
@@ -0,0 +1,10 @@
+module Challenge211
+ where
+import Data.List ( (!!) )
+
+isToeplitz :: [[Int]] -> Bool
+isToeplitz list = allSame $ map (\p -> ( snd p ) !! ( fst p ) )
+ $ zip [0..length list - 1] list
+ where
+ allSame :: [Int] -> Bool
+ allSame aList = all (\n -> n == ( head aList ) ) aList
diff --git a/challenge-211/ulrich-rieke/haskell/ch-2.hs b/challenge-211/ulrich-rieke/haskell/ch-2.hs
new file mode 100644
index 0000000000..e7f491363f
--- /dev/null
+++ b/challenge-211/ulrich-rieke/haskell/ch-2.hs
@@ -0,0 +1,32 @@
+module Challenge211_2
+ where
+import Data.List ( (\\) )
+
+combinations :: Int -> [a] -> [[a]]
+combinations 0 _ = [[]]
+combinations n xs = [ xs !! i : x | i <- [0..(length xs ) - 1 ] ,
+x <- combinations (n - 1 ) ( drop ( i + 1 ) xs ) ]
+
+subAction :: [Int] -> [Int] -> ([Int] , [Int] )
+subAction totalList aCombination = (aCombination , totalList \\ aCombination)
+
+solution :: [Int] -> Bool
+solution list
+ |l == 1 = True
+ |l == 2 = head list == last list
+ |l > 2 = any (\(l1 , l2) -> average l1 == average l2 ) $ map
+ (\sublist -> subAction list sublist ) $ concat $ map
+ (\i -> combinations i list ) [div ( l - 1 ) 2 .. l - 1]
+ where
+ average :: [Int] -> Double
+ average someList = (fromIntegral $ sum someList ) / ( fromIntegral $ length
+ someList )
+ l :: Int
+ l = length list
+
+main :: IO ( )
+main = do
+ putStrLn "Please enter some integers, separated by blanks!"
+ numberstrings <- getLine
+ let numbers = map read $ words numberstrings
+ if solution numbers then print "true" else print "false"
diff --git a/challenge-211/ulrich-rieke/perl/ch-1.pl b/challenge-211/ulrich-rieke/perl/ch-1.pl
new file mode 100644
index 0000000000..d89faa31cb
--- /dev/null
+++ b/challenge-211/ulrich-rieke/perl/ch-1.pl
@@ -0,0 +1,28 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+use List::Util qw ( all ) ;
+
+say "Enter a matrix, consisting of lines of equal numbers of integers , end to end!" ;
+my @matrix ;
+my $line = <STDIN> ;
+chomp $line ;
+while ( $line ne "end" ) {
+ my @numbers = split( /\s/ , $line ) ;
+ push @matrix , \@numbers ;
+ say "Enter a line of integers, end to end!" ;
+ $line = <STDIN> ;
+ chomp $line ;
+}
+my @diagonals ;
+my $len = scalar( @matrix ) ;
+for my $i ( 0..$len - 1 ) {
+ push @diagonals , $matrix[$i]->[$i] ;
+}
+if ( all { $_ == $diagonals[ 0 ] } @diagonals ) {
+ say "true" ;
+}
+else {
+ say "false" ;
+}
diff --git a/challenge-211/ulrich-rieke/perl/ch-2.pl b/challenge-211/ulrich-rieke/perl/ch-2.pl
new file mode 100644
index 0000000000..d8a4f7e8f7
--- /dev/null
+++ b/challenge-211/ulrich-rieke/perl/ch-2.pl
@@ -0,0 +1,78 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+use Algorithm::Combinatorics qw( combinations ) ;
+use List::Util qw ( sum all ) ;
+
+sub findArrayDifference {
+ my $superArray = shift ;
+ my $subArray = shift ;
+ my %firstHash ;
+ my %secondHash ;
+ for my $el ( @$superArray ) {
+ $firstHash{ $el }++ ;
+ }
+ for my $el ( @$subArray ) {
+ $secondHash{ $el }++ ;
+ }
+ my @difference ;
+ for my $k ( keys %secondHash ) {
+ $firstHash{ $k } -= $secondHash{ $k } ;
+ }
+ for my $k ( keys %firstHash ) {
+ if ( $firstHash{ $k } > 0 ) {
+ for my $i ( 0..$firstHash{ $k } - 1 ) {
+ push @difference , $k ;
+ }
+ }
+ }
+ return @difference ;
+}
+
+sub findAverage {
+ my $subarray = shift ;
+ my $len = scalar( @$subarray ) ;
+ my $sum = sum( @$subarray ) ;
+ return $sum / $len ;
+}
+
+say "Enter some integers, separated by blanks!" ;
+my $line = <STDIN> ;
+chomp $line ;
+my @numbers = split( /\s/ , $line ) ;
+my $len = scalar( @numbers ) ;
+if ( $len == 1 ) {
+ say "true" ;
+}
+else { #$len > 1
+ my $result = 0 ;
+ if ( $len == 2 ) {
+ if ( $numbers[ 0 ] == $numbers[1] ) {
+ $result = 1 ;
+ }
+ else {
+ }
+ }
+ else { # $len > 2
+ my $limit = int( $len / 2 ) ;
+ my $currentLen = $len - 1 ;
+ COMBI: while ( $currentLen > $limit ) {
+ my $iter = combinations(\@numbers, $currentLen ) ;
+ while ( my $c = $iter->next ) {
+ my @difference = findArrayDifference( \@numbers , $c ) ;
+ if ( findAverage( \@difference ) == findAverage( $c ) ) {
+ $result = 1 ;
+ last COMBI ;
+ }
+ }
+ $currentLen-- ;
+ }
+ }
+ if ( $result ) {
+ say "true" ;
+ }
+ else {
+ say "false" ;
+ }
+}
diff --git a/challenge-211/ulrich-rieke/raku/ch-1.raku b/challenge-211/ulrich-rieke/raku/ch-1.raku
new file mode 100644
index 0000000000..818053cfc8
--- /dev/null
+++ b/challenge-211/ulrich-rieke/raku/ch-1.raku
@@ -0,0 +1,22 @@
+use v6 ;
+
+say "Enter some integers as part of a matrix, same number each line, end to end!" ;
+my $line = $*IN.get ;
+my @matrix ;
+while ( $line ne "end" ) {
+ my @numbers = $line.words.map( {.Int} ) ;
+ @matrix.push( @numbers ) ;
+ say "Enter some integers, end to end!" ;
+ $line = $*IN.get ;
+}
+my @diagonals ;
+my $len = @matrix.elems ;
+for (0..$len - 1 ) -> $i {
+ @diagonals.push( @matrix[$i][$i] ) ;
+}
+if ( @diagonals.grep( { $_ == @diagonals[0] } ).elems == $len ) {
+ say "true" ;
+}
+else {
+ say "false" ;
+}
diff --git a/challenge-211/ulrich-rieke/rust/ch-2.rs b/challenge-211/ulrich-rieke/rust/ch-2.rs
new file mode 100644
index 0000000000..2f4c3b4687
--- /dev/null
+++ b/challenge-211/ulrich-rieke/rust/ch-2.rs
@@ -0,0 +1,83 @@
+use std::io;
+use itertools::Itertools ;
+use std::collections::HashMap ;
+
+fn find_difference( first_vec : &Vec<i32> , second_vec : &Vec<&i32> ) ->
+Vec<i32> {
+ let mut first_map : HashMap<i32 , usize> = HashMap::new( ) ;
+ let mut second_map : HashMap<i32, usize> = HashMap::new( ) ;
+ let mut difference : Vec<i32> = Vec::new( ) ;
+ for num in first_vec {
+ first_map.entry( *num ).and_modify( | counter | *counter += 1).
+ or_insert( 1 ) ;
+ }
+ for num in second_vec {
+ second_map.entry( **num ).and_modify( | counter | *counter += 1).
+ or_insert( 1 ) ;
+ }
+ for key in second_map.keys( ) {
+ first_map.entry( *key ).and_modify( | counter | *counter -=
+ second_map.get( &key ).unwrap( ) ) ;
+ }
+ for key in first_map.keys( ) {
+ match first_map.get( &key ) {
+ Some( val ) => {
+ for _ in 0..*val {
+ difference.push( *key ) ;
+ }
+ } ,
+ None => { } ,
+ } ;
+ }
+ difference
+}
+
+fn average( vector : &Vec<i32> ) -> f32 {
+ let len : f32 = vector.len( ) as f32 ;
+ let mut copy : Vec<f32> = Vec::new( ) ;
+ vector.iter( ).for_each( | i | copy.push( *i as f32 )) ;
+ let sum = copy.iter( ).sum::<f32>( ) ;
+ sum / len
+}
+
+fn main() {
+ println!("Enter some integers, separated by blanks!");
+ let mut inline : String = String::new( ) ;
+ io::stdin( ).read_line( &mut inline ).unwrap( ) ;
+ let entered_line : &str = &*inline ;
+ let numbers : Vec<i32> = entered_line.split_whitespace( ).map( | s |
+ s.trim( ).parse::<i32>( ).unwrap( ) ).collect( ) ;
+ let mut result : bool = false ;
+ let len = numbers.len( ) ;
+ if len == 1 {
+ result = true ;
+ }
+ else {
+ if numbers.iter( ).all( | i | *i == numbers[ 0 ] ) {
+ if len % 2 == 0 {
+ result = true ;
+ }
+ else {
+ result = false ;
+ }
+ }
+ else {
+ let mut combinum = len - 1 ;
+ 'myloop: while combinum > len / 2 {
+ for v in numbers.iter( ).combinations( combinum ) {
+ let difference = find_difference( &numbers , &v ) ;
+ let mut combi : Vec<i32> = Vec::new( ) ;
+ v.iter( ).for_each( | i | combi.push( **i ) ) ;
+ if average( &difference ) == average( &combi ) {
+ result = true ;
+ break 'myloop ;
+ }
+ else {
+ }
+ }
+ combinum -= 1 ;
+ }
+ }
+ }
+ println!("{}" , result ) ;
+}
diff --git a/stats/pwc-challenge-210.json b/stats/pwc-challenge-210.json
new file mode 100644
index 0000000000..44aaa7359a
--- /dev/null
+++ b/stats/pwc-challenge-210.json
@@ -0,0 +1,611 @@
+{
+ "plotOptions" : {
+ "series" : {
+ "borderWidth" : 0,
+ "dataLabels" : {
+ "format" : "{point.y}",
+ "enabled" : 1
+ }
+ }
+ },
+ "chart" : {
+ "type" : "column"
+ },
+ "tooltip" : {
+ "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>",
+ "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>",
+ "followPointer" : 1
+ },
+ "series" : [
+ {
+ "colorByPoint" : 1,
+ "name" : "The Weekly Challenge - 210",
+ "data" : [
+ {
+ "y" : 3,
+ "drilldown" : "Arne Sommer",
+ "name" : "Arne Sommer"
+ },
+ {
+ "drilldown" : "Athanasius",
+ "name" : "Athanasius",
+ "y" : 2
+ },
+ {
+ "y" : 2,
+ "name" : "Avery Adams",
+ "drilldown" : "Avery Adams"
+ },
+ {
+ "name" : "Bob Lied",
+ "drilldown" : "Bob Lied",
+ "y" : 2
+ },
+ {
+ "y" : 2,
+ "name" : "Carlos Oliveira",
+ "drilldown" : "Carlos Oliveira"
+ },
+ {
+ "drilldown" : "Cheok-Yin Fung",
+ "name" : "Cheok-Yin Fung",
+ "y" : 1
+ },
+ {
+ "y" : 2,
+ "drilldown" : "David Ferrone",
+ "name" : "David Ferrone"
+ },
+ {
+ "y" : 2,
+ "name" : "Duncan C. White",
+ "drilldown" : "Duncan C. White"
+ },
+ {
+ "drilldown" : "E. Choroba",
+ "name" : "E. Choroba",
+ "y" : 2
+ },
+ {
+ "y" : 6,
+ "drilldown" : "Flavio Poletti",
+ "name" : "Flavio Poletti"
+ },
+ {
+ "drilldown" : "James Smith",
+ "name" : "James Smith",
+ "y" : 3
+ },
+ {
+ "y" : 1,
+ "name" : "Jan Krnavek",
+ "drilldown" : "Jan Krnavek"
+ },
+ {
+ "name" : "Jorg Sommrey",
+ "drilldown" : "Jorg Sommrey",
+ "y" : 2
+ },
+ {
+ "drilldown" : "Laurent Rosenfeld",
+ "name" : "Laurent Rosenfeld",
+ "y" : 4
+ },
+ {
+ "y" : 8,
+ "drilldown" : "Luca Ferrari",
+ "name" : "Luca Ferrari"
+ },
+ {
+ "name" : "Mariano Spadaccini",
+ "drilldown" : "Mariano Spadaccini",
+ "y" : 1
+ },
+ {
+ "name" : "Mark Anderson",
+ "drilldown" : "Mark Anderson",
+ "y" : 2
+ },
+ {
+ "y" : 2,
+ "name" : "Matthew Neleigh",
+ "drilldown" : "Matthew Neleigh"
+ },
+ {
+ "y" : 2,
+ "drilldown" : "Matthias Muth",
+ "name" : "Matthias Muth"
+ },
+ {
+ "name" : "Paulo Custodio",
+ "drilldown" : "Paulo Custodio",
+ "y" : 2
+ },
+ {
+ "y" : 3,
+ "drilldown" : "Peter Campbell Smith",
+ "name" : "Peter Campbell Smith"
+ },
+ {
+ "y" : 2,
+ "drilldown" : "Peter Meszaros",
+ "name" : "Peter Meszaros"
+ },
+ {
+ "y" : 4,
+ "drilldown" : "Pip Stuart",
+ "name" : "Pip Stuart"
+ },
+ {
+ "y" : 3,
+ "name" : "Robbie Hatley",
+ "drilldown" : "Robbie Hatley"
+ },
+ {
+ "drilldown" : "Robert DiCicco",
+ "name" : "Robert DiCicco",
+ "y" : 2
+ },
+ {
+ "y" : 2,
+ "name" : "Robert Ransbottom",
+ "drilldown" : "Robert Ransbottom"
+ },
+ {
+ "name" : "Roger Bell_West",
+ "drilldown" : "Roger Bell_West",
+ "y" : 4
+ },
+ {
+ "name" : "Shimon Bollinger",
+ "drilldown" : "Shimon Bollinger",
+ "y" : 1
+ },
+ {
+ "y" : 3,
+ "drilldown" : "Simon Green",
+ "name" : "Simon Green"
+ },
+ {
+ "y" : 2,
+ "drilldown" : "Solathian",
+ "name" : "Solathian"
+ },
+ {
+ "y" : 4,
+ "name" : "Thomas Kohler",
+ "drilldown" : "Thomas Kohler"
+ },
+ {
+ "name" : "Ulrich Rieke",
+ "drilldown" : "Ulrich Rieke",
+ "y" : 4
+ },
+ {
+ "y" : 3,
+ "name" : "W. Luis Mochan",
+ "drilldown" : "W. Luis Mochan"
+ }
+ ]
+ }
+ ],
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
+ },
+ "drilldown" : {
+ "series" : [
+ {
+ "name" : "Arne Sommer",
+ "id" : "Arne Sommer",