Given a string s containing only the characters '(', ')', and '*', determine whether s is valid and return true if so.
A string is considered valid if it satisfies all of the following rules:
Every '(' must have a corresponding ')'.
Every ')' must have a corresponding '('.
Each '(' must appear before its corresponding ')'.
The '*' character is flexible and may be interpreted as a '(', a ')', or an empty string "".
Constraints:
s.length
s[i] is either '(', ')', or '*'
Given a string s containing only the characters '(', ')', and '*', determine whether s is valid and return true if so.
A string is considered valid if it satisfies all of the following rules:
Every '(' must have a corresponding ')'.
Every ')' must have a corresponding '('.
Each '(' must appear before its corresponding ')'.
The '*' character is flexible and may be interpreted as a '(', a ')', or an empty string "".
Constraints:
s.length
s[i] is either '(', ')', or '*'