From 70249bd8c70a1b5cdd374d35e42f0eeec79f35d0 Mon Sep 17 00:00:00 2001 From: Lubos Kolouch Date: Mon, 28 Sep 2020 17:15:04 +0200 Subject: Corner case 012 --- challenge-080/lubos-kolouch/perl/ch-1.pl | 4 ++-- 1 file 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; -- cgit