From 7e3512ddfeb976911047c993f357f21abdee6761 Mon Sep 17 00:00:00 2001 From: Lubos Kolouch Date: Mon, 28 Sep 2020 13:20:28 +0200 Subject: Chal 1 empty with tests --- challenge-080/lubos-kolouch/perl/ch_1.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- cgit