From eb89c85d8f90b18bb075d6bc49e009e38294ad39 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 16 Oct 2023 23:39:40 +0100 Subject: - Added solutions by Robert DiCicco. - Added solutions by Ulrich Rieke. - Added solutions by Eric Cheung. - Added solutions by W. Luis Mochan. - Added solutions by Matthias Muth. - Added solutions by rcmlz. - Added solutions by Niels van Dijke. - Added solutions by E. Choroba. - Added solutions by Mark Anderson. - Added solutions by Jaldhar H. Vyas. - Added solutions by PokGoPun. - Added solutions by David Ferrone. - Added solutions by Dave Jacoby. - Added solutions by Peter Meszaros. - Added solutions by Thomas Kohler. --- challenge-239/eric-cheung/python/ch-1.py | 14 ++++++++++++++ challenge-239/eric-cheung/python/ch-2.py | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 challenge-239/eric-cheung/python/ch-1.py create mode 100755 challenge-239/eric-cheung/python/ch-2.py (limited to 'challenge-239/eric-cheung/python') diff --git a/challenge-239/eric-cheung/python/ch-1.py b/challenge-239/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..7d0991df77 --- /dev/null +++ b/challenge-239/eric-cheung/python/ch-1.py @@ -0,0 +1,14 @@ + +## Example 1 +## arrInput_01 = ["ab", "c"] +## arrInput_02 = ["a", "bc"] + +## Example 2 +## arrInput_01 = ["ab", "c"] +## arrInput_02 = ["ac", "b"] + +## Example 3 +arrInput_01 = ["ab", "cd", "e"] +arrInput_02 = ["abcde"] + +print ("".join(arrInput_01) == "".join(arrInput_02)) diff --git a/challenge-239/eric-cheung/python/ch-2.py b/challenge-239/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..dac1eb5222 --- /dev/null +++ b/challenge-239/eric-cheung/python/ch-2.py @@ -0,0 +1,21 @@ + +## Example 1 +## arrStr = ["ad", "bd", "aaab", "baa", "badab"] +## strAllowed = "ab" + +## Example 2 +## arrStr = ["a", "b", "c", "ab", "ac", "bc", "abc"] +## strAllowed = "abc" + +## Example 3 +arrStr = ["cc", "acd", "b", "ba", "bac", "bad", "ac", "d"] +strAllowed = "cad" + +arrOutput = [] + +for strLoop in arrStr: + arrTemp = [charLoop for charLoop in set(strLoop) if charLoop not in strAllowed] + if len(arrTemp) == 0: + arrOutput.append(strLoop) + +print (len(arrOutput)) -- cgit