main
Yanick Champoux 2017-12-03 16:25:02 -05:00
parent eebed65b33
commit 14029d26a5
2 changed files with 14 additions and 0 deletions

4
2015/01/d1.pl Normal file
View File

@ -0,0 +1,4 @@
use 5.20.0;
say eval <> =~ s/\(/+1/gr =~ s/\)/-1/gr;

10
2015/01/d1b.pl Normal file
View File

@ -0,0 +1,10 @@
use 5.20.0;
use List::AllUtils qw/ reduce /;
my $i;
reduce {
my $l = $a + ( $b eq '(' ? 1 : -1 );
$i++;
die $i if $l < 0;
$l;
} 0, split '', <>;