[Java/Python] Stack solution - O(N) - Clean & Concise
Idea\n- Use stack to remove invalid mismatching parentheses, that is:\n\t- Currently, meet closing-parentheses but no opening-parenthesis in the previous -> rem
**Idea**\n- Use stack to remove invalid mismatching parentheses, that is:\n\t- Currently, meet closing-parentheses but no opening-parenthesis in the previous -> remove current closing-parenthesis. For example: `s = "())"`.\n\t- If there are redundant opening-parenthesis at the end, for example: `s = "((()"`.\n\n<iframe src="https://leetcode.com/playground/R22sMX7c/shared" frameBorder="0" width="100%" height="500"></iframe>\n\n**Complexity**\n- Time: `O(N)`, where `N <= 10^5` is length of string `s`.\n- Space: `O(N)`
[]