File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
exercises/practice/anagram/.meta Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,14 @@ tests: |-
99example : |-
1010 sub match_anagrams {
1111 my ($input) = @_;
12- return [];
12+
13+ return [
14+ grep {
15+ lc $_ ne lc $input->{subject}
16+ && join( '', sort( split( //, lc $_ ) ) ) eq
17+ join( '', sort( split( //, lc $input->{subject} ) ) )
18+ } @{ $input->{candidates} }
19+ ];
1320 }
1421
1522stub : |-
Original file line number Diff line number Diff line change @@ -6,7 +6,14 @@ our @EXPORT_OK = qw<match_anagrams>;
66
77sub match_anagrams {
88 my ($input ) = @_ ;
9- return [];
9+
10+ return [
11+ grep {
12+ lc $_ ne lc $input -> {subject }
13+ && join ( ' ' , sort ( split ( // , lc $_ ) ) ) eq
14+ join ( ' ' , sort ( split ( // , lc $input -> {subject } ) ) )
15+ } @{ $input -> {candidates } }
16+ ];
1017}
1118
12191;
You can’t perform that action at this time.
0 commit comments