diff options
| author | Abigail <abigail@abigail.be> | 2021-01-18 17:57:25 +0100 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-01-18 17:57:25 +0100 |
| commit | 6987a3e81c21dbc1bda95ced9fc5e352a337f37e (patch) | |
| tree | 364f4d982e08f587d0c801d85db87770329a66bd | |
| parent | 627ff2ed726fc3b15e0606b0570e10262a2553e6 (diff) | |
| download | perlweeklychallenge-club-6987a3e81c21dbc1bda95ced9fc5e352a337f37e.tar.gz perlweeklychallenge-club-6987a3e81c21dbc1bda95ced9fc5e352a337f37e.tar.bz2 perlweeklychallenge-club-6987a3e81c21dbc1bda95ced9fc5e352a337f37e.zip | |
Tiny optimization for perl solution for week 96, part 2
| -rw-r--r-- | challenge-096/abigail/perl/ch-2.pl | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/challenge-096/abigail/perl/ch-2.pl b/challenge-096/abigail/perl/ch-2.pl index 7fc41b2604..bb58c84569 100644 --- a/challenge-096/abigail/perl/ch-2.pl +++ b/challenge-096/abigail/perl/ch-2.pl @@ -24,8 +24,7 @@ sub LevenshteinDistance ($first, $second) { for (my $i = 0; $i <= length ($first); $i ++) { for (my $j = 0; $j <= length ($second); $j ++) { $$distance [$i] [$j] = - $j == 0 ? $i - : $i == 0 ? $j + $i == 0 || $j == 0 ? $i + $j : min ($$distance [$i - 1] [$j] + 1, $$distance [$i] [$j - 1] + 1, $$distance [$i - 1] [$j - 1] + |
