diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2022-09-03 11:37:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-03 11:37:48 +0100 |
| commit | ca7000cc3ac69a5bb30b00d5c6c8eab3c009a7c3 (patch) | |
| tree | a92d396ab40aaa11d8dee75fb722b6c2f8d175f9 /challenge-180 | |
| parent | 1b63a25595b2461dc76e4011a4661e94605d38b4 (diff) | |
| parent | 54fb7864a82497043094da5d6f72ecf830da8db8 (diff) | |
| download | perlweeklychallenge-club-ca7000cc3ac69a5bb30b00d5c6c8eab3c009a7c3.tar.gz perlweeklychallenge-club-ca7000cc3ac69a5bb30b00d5c6c8eab3c009a7c3.tar.bz2 perlweeklychallenge-club-ca7000cc3ac69a5bb30b00d5c6c8eab3c009a7c3.zip | |
Merge pull request #6686 from E7-87-83/newt
Week 180
Diffstat (limited to 'challenge-180')
| -rw-r--r-- | challenge-180/cheok-yin-fung/perl/ch-1.pl | 12 | ||||
| -rw-r--r-- | challenge-180/cheok-yin-fung/perl/ch-2.pl | 8 | ||||
| -rw-r--r-- | challenge-180/cheok-yin-fung/raku/ch-1.raku | 2 |
3 files changed, 22 insertions, 0 deletions
diff --git a/challenge-180/cheok-yin-fung/perl/ch-1.pl b/challenge-180/cheok-yin-fung/perl/ch-1.pl new file mode 100644 index 0000000000..a7fe2de437 --- /dev/null +++ b/challenge-180/cheok-yin-fung/perl/ch-1.pl @@ -0,0 +1,12 @@ +use v5.30.0; + +my $s = "Long Live Perl"; +my @a = split "", $s; +my %hash; +for (0..$#a) { + $hash{$a[$_]} = 0 if $hash{$a[$_]} == 1; + $hash{$a[$_]} = 1 if !defined($hash{$a[$_]}); +} +my $i = 0; +++$i until $hash{$a[$i]} == 1; +say $i; diff --git a/challenge-180/cheok-yin-fung/perl/ch-2.pl b/challenge-180/cheok-yin-fung/perl/ch-2.pl new file mode 100644 index 0000000000..f917a67771 --- /dev/null +++ b/challenge-180/cheok-yin-fung/perl/ch-2.pl @@ -0,0 +1,8 @@ +@a = split /\D/, $_; say join " ", grep { $_ > $a[0]} @a #perl -nE + + +# perl -nE '@a = split /\D/, $_; say join " ", grep { $_ > $a[0]} @a' +# [input] 3 1 4 2 3 5 +# [output] 4 5 +# [input] 4 9 0 6 2 3 8 5 +# [output] 9 6 8 5 diff --git a/challenge-180/cheok-yin-fung/raku/ch-1.raku b/challenge-180/cheok-yin-fung/raku/ch-1.raku new file mode 100644 index 0000000000..c744ca86c2 --- /dev/null +++ b/challenge-180/cheok-yin-fung/raku/ch-1.raku @@ -0,0 +1,2 @@ +my $s = "Long Live Perl"; +say index($s, first { $s.indices($_).elems == 1 }, $s.comb ); |
