Help for this page

Select Code to Download


  1. or download this
     our @alias = @profit;
        my $maxprofit = pop @alias;
        foreach (@alias){
    ...
        }
        our $index = 0;
        ++$index until $profit[$index] == $maxprofit or $index > $#profit;
    
  2. or download this
    use List::Util qw(max);
       my $maxprofit = max @profit;
       our $index = grep { $profit[$_] eq $maxprofit } 0..$#profit;