Reverse Substrings Between Each Pair of Parentheses

Solution Code

Time Complexity

O(N)

Space Complexity

O(N)