Remove Outermost Parentheses
Easy · Stack & Monotonic Stack · about 10 minutes
Asked at Amazon, Google, Microsoft, Bloomberg.
A valid parentheses string s splits uniquely into primitive parts (non-empty valid strings that can't be split further). Remove the outermost pair of parentheses from every primitive part and return the result.