diff --git a/Shuffle/shuffle.py b/Shuffle/shuffle.py index 4c67472..7095ab0 100644 --- a/Shuffle/shuffle.py +++ b/Shuffle/shuffle.py @@ -8,6 +8,8 @@ Honor Code and Acknowledgments: Comments here on your code and submission. """ +import pprint + def valid_shuffle(a: str, b: str, c: str) -> bool: @@ -28,16 +30,22 @@ def valid_shuffle(a: str, b: str, c: str) -> bool: a_val: bool | None = memo[i + 1][j] if a_val is None: a_val = recurse(i + 1, j) if a[i] == c[k] else False + memo[i + 1][j] = a_val b_val: bool | None = memo[i][j + 1] if b_val is None: b_val = recurse(i, j + 1) if b[j] == c[k] else False + memo[i][j + 1] = b_val memo[i][j] = a_val or b_val return a_val or b_val - return recurse(0, 0) + val = recurse(0, 0) + + pprint.pprint(memo) + + return val # All modules for CS 412 must include a main method that allows it