diff options
| author | Myoungjin JEON <jeongoon@gmail.com> | 2020-08-20 22:04:20 +1000 |
|---|---|---|
| committer | Myoungjin JEON <jeongoon@gmail.com> | 2020-08-20 22:04:20 +1000 |
| commit | 3b660bd6b0556f43ee01a2f62c2aeb5611292c66 (patch) | |
| tree | c351f474c1091e3e6768551f94538a9a18222fc2 | |
| parent | 982554f03910669b50c7090262aed38c14152e67 (diff) | |
| download | perlweeklychallenge-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.pl | 2 | ||||
| -rw-r--r-- | challenge-074/jeongoon/raku/ch-2.raku | 4 |
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; |
