aboutsummaryrefslogtreecommitdiff
path: root/challenge-082/walt-mankowski/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-082/walt-mankowski/python/ch-2.py')
-rw-r--r--challenge-082/walt-mankowski/python/ch-2.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-082/walt-mankowski/python/ch-2.py b/challenge-082/walt-mankowski/python/ch-2.py
new file mode 100644
index 0000000000..ca2a2d551d
--- /dev/null
+++ b/challenge-082/walt-mankowski/python/ch-2.py
@@ -0,0 +1,23 @@
+from sys import argv
+
+def is_interleave(a, b, c):
+ if a == '' and b == '' and c == '':
+ return 1
+
+ try:
+ if a[0] == c[0]:
+ return is_interleave(a[1:], b, c[1:])
+ except IndexError:
+ pass
+
+ try:
+ if b[0] == c[0]:
+ return is_interleave(a, b[1:], c[1:])
+ except IndexError:
+ pass
+
+ return 0
+
+a, b, c = argv[1:]
+
+print(is_interleave(a, b, c))