aboutsummaryrefslogtreecommitdiff
path: root/challenge-239/eric-cheung/python
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-239/eric-cheung/python')
-rwxr-xr-xchallenge-239/eric-cheung/python/ch-1.py14
-rwxr-xr-xchallenge-239/eric-cheung/python/ch-2.py21
2 files changed, 35 insertions, 0 deletions
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))