diff options
Diffstat (limited to 'challenge-154/paulo-custodio/python/ch-1.py')
| -rw-r--r-- | challenge-154/paulo-custodio/python/ch-1.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-154/paulo-custodio/python/ch-1.py b/challenge-154/paulo-custodio/python/ch-1.py new file mode 100644 index 0000000000..1b121593e6 --- /dev/null +++ b/challenge-154/paulo-custodio/python/ch-1.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +# Challenge 154 +# +# TASK #1 > Missing Permutation +# Submitted by: Mohammad S Anwar +# You are given possible permutations of the string 'PERL'. +# +# PELR, PREL, PERL, PRLE, PLER, PLRE, EPRL, EPLR, ERPL, +# ERLP, ELPR, ELRP, RPEL, RPLE, REPL, RELP, RLPE, RLEP, +# LPER, LPRE, LEPR, LRPE, LREP +# Write a script to find any permutations missing from the list. + +from itertools import permutations + +have = { + "PELR", "PREL", "PERL", "PRLE", "PLER", "PLRE", "EPRL", "EPLR", "ERPL", + "ERLP", "ELPR", "ELRP", "RPEL", "RPLE", "REPL", "RELP", "RLPE", "RLEP", + "LPER", "LPRE", "LEPR", "LRPE", "LREP" +} + +all_permutations = {''.join(p) for p in permutations("PERL")} +missing = sorted(set(all_permutations) - have) + +print(", ".join(missing)) |
