DEV Community

loading...

Discussion on: Daily Challenge #12 - Next Larger Number

Collapse
jacoby profile image
Dave Jacoby

Perl 6

#!/usr/bin/env perl6

my $base = 2019;
my @numbers = split('',$base);

my @perm;
for @numbers.permutations -> @n { @perm.push( @n.join('') )}


for @perm.unique.sort -> $p {
    next unless $p > $base;
    say $p ;
    exit;
}