diff options
| author | Lubos Kolouch <lubos@kolouch.net> | 2020-09-28 17:15:04 +0200 |
|---|---|---|
| committer | Lubos Kolouch <lubos@kolouch.net> | 2020-09-28 17:15:04 +0200 |
| commit | 70249bd8c70a1b5cdd374d35e42f0eeec79f35d0 (patch) | |
| tree | dc9ff3ef2e5a52d085458ec5de4057ead0442de6 /challenge-080 | |
| parent | 1cacdbb6efed31b4d4bda32d3b548c3ad9205be4 (diff) | |
| download | perlweeklychallenge-club-70249bd8c70a1b5cdd374d35e42f0eeec79f35d0.tar.gz perlweeklychallenge-club-70249bd8c70a1b5cdd374d35e42f0eeec79f35d0.tar.bz2 perlweeklychallenge-club-70249bd8c70a1b5cdd374d35e42f0eeec79f35d0.zip | |
Corner case 012
Diffstat (limited to 'challenge-080')
| -rw-r--r-- | challenge-080/lubos-kolouch/perl/ch-1.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-080/lubos-kolouch/perl/ch-1.pl b/challenge-080/lubos-kolouch/perl/ch-1.pl index 7461ceb1b9..8decd6a953 100644 --- a/challenge-080/lubos-kolouch/perl/ch-1.pl +++ b/challenge-080/lubos-kolouch/perl/ch-1.pl @@ -14,7 +14,7 @@ use strict; use warnings; -use List::Util qw/min/; +use List::Util qw/min max/; use feature qw/say/; sub get_smallest_missing { @@ -29,7 +29,7 @@ sub get_smallest_missing { # NOTE: the excercise does not say what to do if there is nothing missing # so let's just return 0 as per Twitter confirmation - for (0..scalar @$arr-2) { + while ($arr_min < max(@$arr)) { $arr_min++; return $arr_min unless grep { $_ == $arr_min } @$arr; |
