|
4 | 4 | importjava.util.Queue; |
5 | 5 | importjava.util.Stack; |
6 | 6 |
|
7 | | -/** |
8 | | - * 1190. Reverse Substrings Between Each Pair of Parentheses |
9 | | - * |
10 | | - * You are given a string s that consists of lower case English letters and brackets. |
11 | | - * Reverse the strings in each pair of matching parentheses, starting from the innermost one. |
12 | | - * Your result should not contain any brackets. |
13 | | - * |
14 | | - * Example 1: |
15 | | - * Input: s = "(abcd)" |
16 | | - * Output: "dcba" |
17 | | - * |
18 | | - * Example 2: |
19 | | - * Input: s = "(u(love)i)" |
20 | | - * Output: "iloveu" |
21 | | - * Explanation: The substring "love" is reversed first, then the whole string is reversed. |
22 | | - * |
23 | | - * Example 3: |
24 | | - * Input: s = "(ed(et(oc))el)" |
25 | | - * Output: "leetcode" |
26 | | - * Explanation: First, we reverse the substring "oc", then "etco", and finally, the whole string. |
27 | | - * |
28 | | - * Example 4: |
29 | | - * Input: s = "a(bcdefghijkl(mno)p)q" |
30 | | - * Output: "apmnolkjihgfedcbq" |
31 | | - * |
32 | | - * Constraints: |
33 | | - * 0 <= s.length <= 2000 |
34 | | - * s only contains lower case English characters and parentheses. |
35 | | - * It's guaranteed that all parentheses are balanced. |
36 | | - * */ |
37 | 7 | publicclass_1190 { |
38 | 8 | publicstaticclassSolution1 { |
39 | 9 | publicStringreverseParentheses(Strings) { |
|