diff options
| -rw-r--r-- | challenge-080/lubos-kolouch/perl/ch_1.pl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/challenge-080/lubos-kolouch/perl/ch_1.pl b/challenge-080/lubos-kolouch/perl/ch_1.pl index 0b712a913a..e19e7bf626 100644 --- a/challenge-080/lubos-kolouch/perl/ch_1.pl +++ b/challenge-080/lubos-kolouch/perl/ch_1.pl @@ -14,16 +14,21 @@ use strict; use warnings; +use List::Util qw/min/; +use feature qw/say/; sub get_smallest_missing { my $arr = shift; + # map the arr to hash + say min( grep { $_ > 0 } @$arr); + } use Test::More; is(get_smallest_missing([5, 2, -2, 0]), 1); -is(get_smallest_missing([1, 8, -1]), 1); +is(get_smallest_missing([1, 8, -1]), 2); is(get_smallest_missing([2, 0, 1]), 1); done_testing; |
