aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-001/paulo-custodio/check_challenge_title.pl10
-rw-r--r--challenge-023/paulo-custodio/Makefile2
-rw-r--r--challenge-023/paulo-custodio/perl/ch-1.pl4
-rw-r--r--challenge-023/paulo-custodio/perl/ch-2.pl7
-rw-r--r--challenge-023/paulo-custodio/python/ch-1.py32
-rw-r--r--challenge-023/paulo-custodio/python/ch-2.py38
-rw-r--r--challenge-023/paulo-custodio/t/test-1.yaml15
-rw-r--r--challenge-023/paulo-custodio/t/test-2.yaml55
-rw-r--r--challenge-023/paulo-custodio/test.pl30
-rw-r--r--challenge-024/paulo-custodio/perl/ch-1.pl0
-rw-r--r--challenge-111/james-smith/perl/ch-1.pl50
-rw-r--r--challenge-111/james-smith/perl/ch-2.pl46
-rw-r--r--challenge-113/james-smith/perl/BinaryTree.pm66
-rw-r--r--challenge-113/james-smith/perl/ch-2.pl42
-rw-r--r--challenge-115/james-smith/perl/ch-1.pl3
-rw-r--r--challenge-115/james-smith/perl/ch-2.pl27
-rw-r--r--challenge-121/james-smith/perl/ch-2.pl2
-rw-r--r--challenge-125/james-smith/perl/BinaryTree.pm10
-rw-r--r--challenge-126/james-smith/perl/ch-1.pl1
-rw-r--r--challenge-130/james-smith/perl/ch-1.pl24
-rw-r--r--challenge-131/james-smith/perl/ch-2.pl35
-rw-r--r--challenge-133/james-smith/c/ch-2.c30
-rw-r--r--challenge-136/james-smith/README.md4
-rw-r--r--challenge-136/james-smith/perl/ch-1.pl3
-rw-r--r--challenge-136/james-smith/perl/ch-2.pl10
-rw-r--r--challenge-137/james-smith/README.md3
-rw-r--r--challenge-137/james-smith/perl/ch-2.pl16
-rw-r--r--challenge-138/james-smith/README.md5
-rw-r--r--challenge-139/james-smith/README.md3
-rw-r--r--challenge-140/james-smith/README.md46
-rw-r--r--challenge-140/james-smith/perl/ch-1.pl12
-rw-r--r--challenge-140/james-smith/perl/ch-2.pl17
-rw-r--r--challenge-141/james-smith/README.md75
-rw-r--r--challenge-141/james-smith/perl/ch-1.pl32
-rw-r--r--challenge-141/james-smith/perl/ch-2.pl26
-rw-r--r--challenge-141/roger-bell-west/blog.txt1
-rw-r--r--challenge-142/abigail/README.md31
-rw-r--r--challenge-142/abigail/blog.txt1
-rw-r--r--challenge-142/abigail/blog1.txt1
-rw-r--r--challenge-142/abigail/perl/ch-1.pl10
-rw-r--r--challenge-142/abigail/perl/ch-2.pl16
-rwxr-xr-xchallenge-142/e-choroba/perl/ch-1.pl30
-rwxr-xr-xchallenge-142/e-choroba/perl/ch-2.pl23
-rwxr-xr-xchallenge-142/eric-cheung/excel-vba/Challenge_142.xlsmbin0 -> 25970 bytes
-rwxr-xr-xchallenge-142/eric-cheung/excel-vba/ch-1.bas42
-rwxr-xr-xchallenge-142/eric-cheung/python/ch-2.py19
-rw-r--r--challenge-142/james-smith/README.md81
-rw-r--r--challenge-142/james-smith/blog.txt1
-rw-r--r--challenge-142/james-smith/perl/ch-1.pl28
-rw-r--r--challenge-142/james-smith/perl/ch-2.pl23
-rw-r--r--challenge-142/luca-ferrari/blog-1.txt1
-rw-r--r--challenge-142/luca-ferrari/blog-2.txt1
-rw-r--r--challenge-142/luca-ferrari/blog-3.txt1
-rw-r--r--challenge-142/luca-ferrari/blog-4.txt1
-rw-r--r--challenge-142/luca-ferrari/postgresql/ch-1.sql20
-rw-r--r--challenge-142/luca-ferrari/postgresql/ch-2.sh7
-rw-r--r--challenge-142/luca-ferrari/raku/ch-1.p66
-rw-r--r--challenge-142/luca-ferrari/raku/ch-2.p610
-rw-r--r--challenge-142/paulo-custodio/perl/ch-1.pl41
-rw-r--r--challenge-142/paulo-custodio/perl/ch-2.pl24
-rw-r--r--challenge-142/paulo-custodio/python/ch-1.py42
-rw-r--r--challenge-142/paulo-custodio/python/ch-2.py26
-rw-r--r--challenge-142/paulo-custodio/t/test-1.yaml10
-rw-r--r--challenge-142/paulo-custodio/t/test-2.yaml14
-rw-r--r--challenge-142/robert-dicicco/perl/ch-1.pl73
-rw-r--r--challenge-142/robert-dicicco/perl/ch-2.pl55
-rw-r--r--challenge-142/roger-bell-west/blog.txt1
-rwxr-xr-xchallenge-142/roger-bell-west/perl/ch-1.pl36
-rwxr-xr-xchallenge-142/roger-bell-west/perl/ch-2.pl35
-rw-r--r--challenge-142/roger-bell-west/postscript/ch-1.ps44
-rwxr-xr-xchallenge-142/roger-bell-west/python/ch-1.py35
-rwxr-xr-xchallenge-142/roger-bell-west/python/ch-2.py35
-rwxr-xr-xchallenge-142/roger-bell-west/raku/ch-1.p631
-rwxr-xr-xchallenge-142/roger-bell-west/raku/ch-2.p627
-rwxr-xr-xchallenge-142/roger-bell-west/ruby/ch-1.rb40
-rwxr-xr-xchallenge-142/roger-bell-west/ruby/ch-2.rb26
-rwxr-xr-xchallenge-142/roger-bell-west/rust/ch-1.rs44
-rw-r--r--challenge-142/roger-bell-west/rust/ch-2.rs41
-rw-r--r--challenge-142/ulrich-rieke/cpp/ch-1.cpp21
-rw-r--r--challenge-142/ulrich-rieke/haskell/ch-1.hs8
-rw-r--r--challenge-142/ulrich-rieke/perl/ch-1.pl20
-rw-r--r--challenge-142/ulrich-rieke/raku/ch-1.raku12
-rw-r--r--challenge-142/ulrich-rieke/raku/ch-2.raku15
-rw-r--r--stats/pwc-challenge-024.json228
-rw-r--r--stats/pwc-challenge-141.json267
-rw-r--r--stats/pwc-current.json217
-rw-r--r--stats/pwc-language-breakdown-summary.json78
-rw-r--r--stats/pwc-language-breakdown.json1030
-rw-r--r--stats/pwc-leaders.json836
-rw-r--r--stats/pwc-summary-1-30.json126
-rw-r--r--stats/pwc-summary-121-150.json38
-rw-r--r--stats/pwc-summary-151-180.json104
-rw-r--r--stats/pwc-summary-181-210.json120
-rw-r--r--stats/pwc-summary-211-240.json96
-rw-r--r--stats/pwc-summary-241-270.json44
-rw-r--r--stats/pwc-summary-31-60.json100
-rw-r--r--stats/pwc-summary-61-90.json102
-rw-r--r--stats/pwc-summary-91-120.json110
-rw-r--r--stats/pwc-summary.json76
99 files changed, 3577 insertions, 1886 deletions
diff --git a/challenge-001/paulo-custodio/check_challenge_title.pl b/challenge-001/paulo-custodio/check_challenge_title.pl
index cd36c62e87..02a8d1babd 100644
--- a/challenge-001/paulo-custodio/check_challenge_title.pl
+++ b/challenge-001/paulo-custodio/check_challenge_title.pl
@@ -33,10 +33,10 @@ for my $chall_dir (path(".")->children(qr/challenge-\d+/)) {
next unless $dir->is_dir;
for my $sol ($dir->children(qr/^ch[-_]\d\.$LANG{$lang}$/)) {
- my $text = $sol->slurp;
- if ($text !~ /Challenge 0*$chall\b/) {
- say $sol;
- }
- }
+ my $text = $sol->slurp;
+ if ($text !~ /Challenge 0*$chall\b/) {
+ say $sol;
+ }
+ }
}
}
diff --git a/challenge-023/paulo-custodio/Makefile b/challenge-023/paulo-custodio/Makefile
new file mode 100644
index 0000000000..c3c762d746
--- /dev/null
+++ b/challenge-023/paulo-custodio/Makefile
@@ -0,0 +1,2 @@
+all:
+ perl ../../challenge-001/paulo-custodio/test.pl
diff --git a/challenge-023/paulo-custodio/perl/ch-1.pl b/challenge-023/paulo-custodio/perl/ch-1.pl
index ee500f38dc..581caa45f9 100644
--- a/challenge-023/paulo-custodio/perl/ch-1.pl
+++ b/challenge-023/paulo-custodio/perl/ch-1.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!/usr/bin/perl
# Challenge 023
#
@@ -19,7 +19,7 @@
use Modern::Perl;
my($n, @seq) = @ARGV;
-say join(", ", nth_forward_diff($n, @seq)), ".";
+say join(", ", nth_forward_diff($n, @seq));
sub forward_diff {
diff --git a/challenge-023/paulo-custodio/perl/ch-2.pl b/challenge-023/paulo-custodio/perl/ch-2.pl
index 62f450ba8d..695e54128d 100644
--- a/challenge-023/paulo-custodio/perl/ch-2.pl
+++ b/challenge-023/paulo-custodio/perl/ch-2.pl
@@ -1,16 +1,17 @@
-#!/usr/bin/env perl
+#!/usr/bin/perl
# Challenge 023
#
# Task #2
# Create a script that prints Prime Decomposition of a given number. The prime
# decomposition of a number is defined as a list of prime numbers which when
-# all multiplied together, are equal to that number. For example, the Prime decomposition of 228 is 2,2,3,19 as 228 = 2 * 2 * 3 * 19.
+# all multiplied together, are equal to that number. For example, the Prime
+# decomposition of 228 is 2,2,3,19 as 228 = 2 * 2 * 3 * 19.
use Modern::Perl;
my($n) = @ARGV;
-say join(", ", prime_decomposition($n)), ".";
+say join(", ", prime_decomposition($n));
# check if number is prime
diff --git a/challenge-023/paulo-custodio/python/ch-1.py b/challenge-023/paulo-custodio/python/ch-1.py
new file mode 100644
index 0000000000..5baa57d74a
--- /dev/null
+++ b/challenge-023/paulo-custodio/python/ch-1.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python3
+
+# Challenge 023
+#
+# Task #1
+# Create a script that prints nth order forward difference series. You should
+# be a able to pass the list of numbers and order number as command line
+# parameters. Let me show you with an example.
+#
+# Suppose we have list (X) of numbers: 5, 9, 2, 8, 1, 6 and we would like to
+# create 1st order forward difference series (Y). So using the formula
+# Y(i) = X(i+1) - X(i), we get the following numbers:
+# (9-5), (2-9), (8-2), (1-8), (6-1).
+# In short, the final series would be: 4, -7, 6, -7, 5.
+# If you noticed, it has one less number than the original series.
+# Similarly you can carry on 2nd order forward difference series like:
+# (-7-4), (6+7), (-7-6), (5+7) => -11, 13, -13, 12.
+
+import sys
+
+def forward_diff(seq):
+ return [seq[i+1]-seq[i] for i in range(len(seq)-1)]
+
+def nth_forward_diff(n ,seq):
+ for i in range(n):
+ seq = forward_diff(seq)
+ return seq
+
+n = int(sys.argv[1])
+seq = [int(x) for x in sys.argv[2:]]
+seq = nth_forward_diff(n ,seq)
+print(", ".join([str(x) for x in seq]))
diff --git a/challenge-023/paulo-custodio/python/ch-2.py b/challenge-023/paulo-custodio/python/ch-2.py
new file mode 100644
index 0000000000..4438d1af8a
--- /dev/null
+++ b/challenge-023/paulo-custodio/python/ch-2.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python3
+
+# Challenge 023
+#
+# Task #2
+# Create a script that prints Prime Decomposition of a given number. The prime
+# decomposition of a number is defined as a list of prime numbers which when
+# all multiplied together, are equal to that number. For example, the Prime
+# decomposition of 228 is 2,2,3,19 as 228 = 2 * 2 * 3 * 19.
+
+import sys
+from primePy import primes
+
+def next_prime(n):
+ if n <= 1:
+ return 2
+ else:
+ n += 1
+ while not primes.check(n):
+ n += 1
+ return n
+
+def prime_decomposition(n):
+ if n<2:
+ return [n]
+
+ f = []
+ p = 2
+ while n>1:
+ if n%p == 0:
+ f.append(p)
+ n //= p
+ else:
+ p = next_prime(p)
+ return f
+
+f = prime_decomposition(int(sys.argv[1]))
+print(", ".join([str(x) for x in f]))
diff --git a/challenge-023/paulo-custodio/t/test-1.yaml b/challenge-023/paulo-custodio/t/test-1.yaml
new file mode 100644
index 0000000000..d93bef9607
--- /dev/null
+++ b/challenge-023/paulo-custodio/t/test-1.yaml
@@ -0,0 +1,15 @@
+- setup:
+ cleanup:
+ args: 1 5 9 2 8 1 6
+ input:
+ output: 4, -7, 6, -7, 5
+- setup:
+ cleanup:
+ args: 2 5 9 2 8 1 6
+ input:
+ output: -11, 13, -13, 12
+- setup:
+ cleanup:
+ args: 1 4 -7 6 -7 5
+ input:
+ output: -11, 13, -13, 12
diff --git a/challenge-023/paulo-custodio/t/test-2.yaml b/challenge-023/paulo-custodio/t/test-2.yaml
new file mode 100644
index 0000000000..f94852e4f0
--- /dev/null
+++ b/challenge-023/paulo-custodio/t/test-2.yaml
@@ -0,0 +1,55 @@
+- setup:
+ cleanup:
+ args: 1
+ input:
+ output: 1
+- setup:
+ cleanup:
+ args: 2
+ input:
+ output: 2
+- setup:
+ cleanup:
+ args: 3
+ input:
+ output: 3
+- setup:
+ cleanup:
+ args: 4
+ input:
+ output: 2, 2
+- setup:
+ cleanup:
+ args: 5
+ input:
+ output: 5
+- setup:
+ cleanup:
+ args: 6
+ input:
+ output: 2, 3
+- setup:
+ cleanup:
+ args: 7
+ input:
+ output: 7
+- setup:
+ cleanup:
+ args: 8
+ input:
+ output: 2, 2, 2
+- setup:
+ cleanup:
+ args: 9
+ input:
+ output: 3, 3
+- setup:
+ cleanup:
+ args: 10
+ input:
+ output: 2, 5
+- setup:
+ cleanup:
+ args: 228
+ input:
+ output: 2, 2, 3, 19
diff --git a/challenge-023/paulo-custodio/test.pl b/challenge-023/paulo-custodio/test.pl
deleted file mode 100644
index bc90aec76b..0000000000
--- a/challenge-023/paulo-custodio/test.pl
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/perl
-
-use Modern::Perl;
-use Test::More;
-use Path::Tiny;
-
-is capture("perl perl/ch-1.pl 1 5 9 2 8 1 6"), "4, -7, 6, -7, 5.\n";
-is capture("perl perl/ch-1.pl 2 5 9 2 8 1 6"), "-11, 13, -13, 12.\n";
-is capture("perl perl/ch-1.pl 1 4 -7 6 -7 5"), "-11, 13, -13, 12.\n";
-
-is capture("perl perl/ch-2.pl 1"), "1.\n";
-is capture("perl perl/ch-2.pl 2"), "2.\n";
-is capture("perl perl/ch-2.pl 3"), "3.\n";
-is capture("perl perl/ch-2.pl 4"), "2, 2.\n";
-is capture("perl perl/ch-2.pl 5"), "5.\n";
-is capture("perl perl/ch-2.pl 6"), "2, 3.\n";
-is capture("perl perl/ch-2.pl 7"), "7.\n";
-is capture("perl perl/ch-2.pl 8"), "2, 2, 2.\n";
-is capture("perl perl/ch-2.pl 9"), "3, 3.\n";
-is capture("perl perl/ch-2.pl 10"), "2, 5.\n";
-is capture("perl perl/ch-2.pl 228"), "2, 2, 3, 19.\n";
-
-done_testing;
-
-sub capture {
- my($cmd) = @_;
- my $out = `$cmd`;
- $out =~ s/[ \t\v\f\r]*\n/\n/g;
- return $out;
-}
diff --git a/challenge-024/paulo-custodio/perl/ch-1.pl b/challenge-024/paulo-custodio/perl/ch-1.pl
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/challenge-024/paulo-custodio/perl/ch-1.pl
diff --git a/challenge-111/james-smith/perl/ch-1.pl b/challenge-111/james-smith/perl/ch-1.pl
index 927633a2c0..4e3efa32ed 100644
--- a/challenge-111/james-smith/perl/ch-1.pl
+++ b/