aboutsummaryrefslogtreecommitdiff
path: root/challenge-263/james-smith
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2024-04-01 18:17:24 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2024-04-01 18:17:24 +0100
commit6e3cd6e8a2eb65b0ba00b4e15e1abeb689a33e8d (patch)
tree9651d8a04663c80427d748c4be9886260db3031f /challenge-263/james-smith
parent0c72fe827b8dcc33de40b2dd35fad3b38fdb06a2 (diff)
downloadperlweeklychallenge-club-6e3cd6e8a2eb65b0ba00b4e15e1abeb689a33e8d.tar.gz
perlweeklychallenge-club-6e3cd6e8a2eb65b0ba00b4e15e1abeb689a33e8d.tar.bz2
perlweeklychallenge-club-6e3cd6e8a2eb65b0ba00b4e15e1abeb689a33e8d.zip
- Added solutions by Mark Anderson.
- Added solutions by Thomas Kohler. - Added solutions by Feng Chang. - Added solutions by Peter Meszaros. - Added solutions by Andrew Shitov. - Added solutions by Steven Wilson. - Added solutions by W. Luis Mochan. - Added solutions by James Smith. - Added solutions by Wanderdoc. - Added solutions by Laurent Rosenfeld. - Added solutions by Eric Cheung.
Diffstat (limited to 'challenge-263/james-smith')
-rw-r--r--challenge-263/james-smith/blog.txt1
-rw-r--r--challenge-263/james-smith/perl/ch-1.pl5
-rw-r--r--challenge-263/james-smith/perl/ch-2.pl7
3 files changed, 13 insertions, 0 deletions
diff --git a/challenge-263/james-smith/blog.txt b/challenge-263/james-smith/blog.txt
new file mode 100644
index 0000000000..e69ad27da2
--- /dev/null
+++ b/challenge-263/james-smith/blog.txt
@@ -0,0 +1 @@
+https://challenges.jamessmith.me.uk/weekly/weekly-challenge-263
diff --git a/challenge-263/james-smith/perl/ch-1.pl b/challenge-263/james-smith/perl/ch-1.pl
new file mode 100644
index 0000000000..7534c1232c
--- /dev/null
+++ b/challenge-263/james-smith/perl/ch-1.pl
@@ -0,0 +1,5 @@
+sub target_index {
+ my( $k, @c ) = ( pop, 0, 0, 0 );
+ $c[ $_ <=> $k ]++ for @_;
+ $c[2] .. $c[2] + $c[0] - 1
+}
diff --git a/challenge-263/james-smith/perl/ch-2.pl b/challenge-263/james-smith/perl/ch-2.pl
new file mode 100644
index 0000000000..784e4ca62c
--- /dev/null
+++ b/challenge-263/james-smith/perl/ch-2.pl
@@ -0,0 +1,7 @@
+sub merge_items {
+ my %c;
+ for( @_ ) {
+ $c{ $_->[0] } += $_->[1] for @{$_}
+ }
+ map { [ 0 + $_ => $c{$_} ] } keys %c
+}