summaryrefslogtreecommitdiff
path: root/perl/p4.pl
blob: 3180cf76cba70c572918d6bada41eee7f9d422e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env perl

use strict;
use warnings;

use List::Util qw(max);

# Functional

# Imperative
my $resp;
for my $x (100 .. 999) {
    for my $y ($x .. 999) {
        my $cand = $x*$y;
        $resp = max($resp, $cand) if $cand eq reverse($cand);
    }
}
print "$resp\n";