aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-05-02 08:51:06 +0100
committerGitHub <noreply@github.com>2021-05-02 08:51:06 +0100
commit6c7b90877823b2bf266c5f233d04250ae43be162 (patch)
treee79d9105c3e8501bfb5bb6fe9869c9f36fc5aa8f
parent230e4408e3b2faeb602a2616a1ab2f9ca23e3201 (diff)
parenta9033deddb8435c32ffa0f1500288cf4473070b8 (diff)
downloadperlweeklychallenge-club-6c7b90877823b2bf266c5f233d04250ae43be162.tar.gz
perlweeklychallenge-club-6c7b90877823b2bf266c5f233d04250ae43be162.tar.bz2
perlweeklychallenge-club-6c7b90877823b2bf266c5f233d04250ae43be162.zip
Merge pull request #3987 from lakpatashi/branch-014
Finished challenge-014 with perl
-rw-r--r--challenge-014/lakpatashi/README1
-rwxr-xr-xchallenge-014/lakpatashi/perl/ch-1.pl24
2 files changed, 25 insertions, 0 deletions
diff --git a/challenge-014/lakpatashi/README b/challenge-014/lakpatashi/README
new file mode 100644
index 0000000000..bc153bd576
--- /dev/null
+++ b/challenge-014/lakpatashi/README
@@ -0,0 +1 @@
+Solution by lakpatashi
diff --git a/challenge-014/lakpatashi/perl/ch-1.pl b/challenge-014/lakpatashi/perl/ch-1.pl
new file mode 100755
index 0000000000..1ea2415974
--- /dev/null
+++ b/challenge-014/lakpatashi/perl/ch-1.pl
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Data::Dumper;
+use List::Util qw(sum);
+use feature qw(switch);
+
+#part 1
+my $max = 1000;
+my @seq = (0)x$max;
+vanEckSeq(); # building pre compiled seq
+
+print "@seq[0..10]\n";
+sub vanEckSeq{
+ for my $i (0..$max-1){
+ for my $j (reverse 0..$i-1){
+ if($seq[$j] == $seq[$i]){
+ $seq[$i+1] = $i-$j;
+ last;
+ }
+ }
+ }
+}