Tap here to switch tabs
Problem
Submissions

Problem: Reverse Substrings Between Each Pair of Parentheses

med
30 min
Try to solve the Reverse Substrings Between Each Pair of Parentheses problem.

Statement

Given a string s consisting of lowercase English letters and parentheses, repeatedly reverse the characters inside each matching pair of parentheses, starting from the innermost pair and working outward. After all reversals are applied, return the resulting string with all parentheses removed.

Note: The parentheses in s are guaranteed to be balanced.

Constraints:

  • 1≤1 \leq s.length ≤2000\leq 2000

  • s contains only lowercase English letters and parentheses

  • All parentheses in s are balanced

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Reverse Substrings Between Each Pair of Parentheses

med
30 min
Try to solve the Reverse Substrings Between Each Pair of Parentheses problem.

Statement

Given a string s consisting of lowercase English letters and parentheses, repeatedly reverse the characters inside each matching pair of parentheses, starting from the innermost pair and working outward. After all reversals are applied, return the resulting string with all parentheses removed.

Note: The parentheses in s are guaranteed to be balanced.

Constraints:

  • 1≤1 \leq s.length ≤2000\leq 2000

  • s contains only lowercase English letters and parentheses

  • All parentheses in s are balanced