We're a place where coders share, stay up-to-date and grow their careers.
Perl
sub adjacentProduct { my @nums = @{ $_[0] }; my $max = 0; for my $i (0..@nums-2) { my $p = $nums[$i] * $nums[$i+1]; $max = $p if $max < $p; } return $max; }
Perl