From b00109b0a5f60fe19e4d3d2c2a978dd0a200969e Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 29 Jun 2020 14:30:01 +0200 Subject: Still an enhanced task 1. --- challenge-067/luca-ferrari/raku/ch-1.p6 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/challenge-067/luca-ferrari/raku/ch-1.p6 b/challenge-067/luca-ferrari/raku/ch-1.p6 index ed10fbdcee..f53e31e497 100644 --- a/challenge-067/luca-ferrari/raku/ch-1.p6 +++ b/challenge-067/luca-ferrari/raku/ch-1.p6 @@ -17,9 +17,10 @@ sub MAIN( Int :$m where { 10 > $m > 2 } = 5, my @digits = $_.comb; next if @digits.elems != $n; next if @digits.grep( * > $m ); - my $ok = True; - $ok = False if ( @digits[ $_ ] >= @digits[ $_ + 1 ] ) for 0 ..^ @digits.elems - 1; - @combinations.push: @digits if $ok; + next if @digits.sort !~~ @digits; + next if @digits.unique !~~ @digits; + + @combinations.push: @digits; } -- cgit