Confluent Interview Question

Similar to wildcard pattern matching using Dynamic Programming.