diff options
| author | Andrew Shitov <mail@andreyshitov.com> | 2025-10-20 11:04:33 +0200 |
|---|---|---|
| committer | Andrew Shitov <mail@andreyshitov.com> | 2025-10-20 11:04:33 +0200 |
| commit | 3379d2813af3034df641c244e04e72472c713681 (patch) | |
| tree | ed1a98c78062682432a8bbe197cf5a42c47059c7 | |
| parent | 18f46ea22406f141268e80c4803185a3e14c0830 (diff) | |
| download | perlweeklychallenge-club-3379d2813af3034df641c244e04e72472c713681.tar.gz perlweeklychallenge-club-3379d2813af3034df641c244e04e72472c713681.tar.bz2 perlweeklychallenge-club-3379d2813af3034df641c244e04e72472c713681.zip | |
Task 2 Week 344 in Raku by @ash
| -rw-r--r-- | challenge-344/ash/raku/ch-2.raku | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-344/ash/raku/ch-2.raku b/challenge-344/ash/raku/ch-2.raku new file mode 100644 index 0000000000..6e192376b8 --- /dev/null +++ b/challenge-344/ash/raku/ch-2.raku @@ -0,0 +1,12 @@ +# Task 2 of the Weekly Challenge 344 +# https://theweeklychallenge.org/blog/perl-weekly-challenge-344/#TASK2 + +say can-form-array(([2,3], [1], [4]), (1, 2, 3, 4)); # True +say can-form-array(([1,3], [2,4]), (1, 2, 3, 4)); # False +say can-form-array(([9,1], [5,8], [2]), (5, 8, 2, 9, 1)); # True +say can-form-array(([1], [3]), (1, 2, 3)); # False +say can-form-array(([7,4,6]), (7, 4, 6)); # True + +sub can-form-array(@source, @target) { + @target ~~ any(@source.permutations>>.flat) +} |
