You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The binary tree data structure is recursively defined. So is the string that represents this data structure in this problem. When a parentheses is encountered, the next node can be recursively parsed to be the left or right node of the current root.
Details:
For this recursive definition of the string, a stack or recursion can be used. Closed-parenthesis would represent end of a parsing of the node too.