Class Solution
java.lang.Object
g1101_1200.s1190_reverse_substrings_between_each_pair_of_parentheses.Solution
1190 - Reverse Substrings Between Each Pair of Parentheses.<p>Medium</p>
<p>You are given a string <code>s</code> that consists of lower case English letters and brackets.</p>
<p>Reverse the strings in each pair of matching parentheses, starting from the innermost one.</p>
<p>Your result should <strong>not</strong> contain any brackets.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = “(abcd)”</p>
<p><strong>Output:</strong> “dcba”</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = “(u(love)i)”</p>
<p><strong>Output:</strong> “iloveu”</p>
<p><strong>Explanation:</strong> The substring “love” is reversed first, then the whole string is reversed.</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> s = “(ed(et(oc))el)”</p>
<p><strong>Output:</strong> “leetcode”</p>
<p><strong>Explanation:</strong> First, we reverse the substring “oc”, then “etco”, and finally, the whole string.</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= s.length <= 2000</code></li>
<li><code>s</code> only contains lower case English characters and parentheses.</li>
<li>It is guaranteed that all parentheses are balanced.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
reverseParentheses
-