Meta asks this frequently to test stack-based parenthesis reasoning.
You're given a string s with lowercase letters and parentheses. Remove the minimum number of parentheses so the result is valid. A valid string has every open parenthesis matched with a close, and no unmatched close parentheses.
For example, s = "lee(t(c)o)de)" becomes "lee(t(c)o)de". You removed the trailing ) that had no match.
Constraints: , characters are a-z, (, or ).