Valid parenthesis string with wildcard *
Asked in the Data structures stage. Given a string s containing (, ), and *, determine whether it can be valid by treating each * as (, ), or an empty character.
Function: is_valid_parenthesis_string(s)
Return True if at least one interpretation is balanced, otherwise return False. A valid string has balanced parentheses, and every closing parenthesis matches an earlier opening parenthesis.
Examples: "(*)" returns True because * can be empty. "(*))" returns True because * can represent (. "())*" returns False.
def is_valid_parenthesis_string(s):