aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyoungjin JEON <jeongoon@gmail.com>2020-08-20 22:04:20 +1000
committerMyoungjin JEON <jeongoon@gmail.com>2020-08-20 22:04:20 +1000
commit3b660bd6b0556f43ee01a2f62c2aeb5611292c66 (patch)
treec351f474c1091e3e6768551f94538a9a18222fc2
parent982554f03910669b50c7090262aed38c14152e67 (diff)
downloadperlweeklychallenge-club-3b660bd6b0556f43ee01a2f62c2aeb5611292c66.tar.gz
perlweeklychallenge-club-3b660bd6b0556f43ee01a2f62c2aeb5611292c66.tar.bz2
perlweeklychallenge-club-3b660bd6b0556f43ee01a2f62c2aeb5611292c66.zip
[ch-074/jeongoon] Perl and Raku solution
-rw-r--r--challenge-074/jeongoon/perl/ch-2.pl2
-rw-r--r--challenge-074/jeongoon/raku/ch-2.raku4
2 files changed, 3 insertions, 3 deletions
diff --git a/challenge-074/jeongoon/perl/ch-2.pl b/challenge-074/jeongoon/perl/ch-2.pl
index c9f619e7e2..251885f8d9 100644
--- a/challenge-074/jeongoon/perl/ch-2.pl
+++ b/challenge-074/jeongoon/perl/ch-2.pl
@@ -6,7 +6,7 @@ use strict; use warnings;
sub uniq_sorted {
my %mem = ();
- map { exists $mem{$_} ? () : ($mem{$_} = $_) } sort @_
+ map { exists $mem{$_} ? () : ($mem{$_} = $_) } @_
}
sub printLNR ($) {
diff --git a/challenge-074/jeongoon/raku/ch-2.raku b/challenge-074/jeongoon/raku/ch-2.raku
index df90bbe567..fba9030909 100644
--- a/challenge-074/jeongoon/raku/ch-2.raku
+++ b/challenge-074/jeongoon/raku/ch-2.raku
@@ -8,7 +8,7 @@ use v6.d;
role fnr {
method sayLNR ( Str:D $str = self.Str ) {
my @chars = $str.comb;
- my @candi = @chars.unique.sort;
+ my @candi = @chars.unique;
for 1 .. @chars.elems -> $last-index {
my $sub-chars = $str.substr( 0, $last-index );
@@ -17,7 +17,7 @@ role fnr {
for @candi -> $c {
given $sub-chars.indices( $c ) {
.elems == 1 or next;
- $nr-pos < .tail and ( $nr-char = $c, $nr-pos = .tail );
+ $nr-pos < .tail and ( $nr-char = $c, $nr-pos = .tail );
}
}
print $nr-char;