Author Archives: Ming Lin


2019.10 — 2015.1.1
2019.11 — 2015.3.15
2019.12 — 2015.6.22 (预计:2015.5.15)
2020.1   — 2015.7.1 (预计:2015.7.15)
2020.2   — 2015.7.15 (预计:2015.9.15)
2020.3   — 2015.8.15 (预计:2015.11.15)
2020.4   — 2015.9.1
2020.5   — 2015.10.1
2020.6   — 2015.11.1


Leetcode 536. Construct Binary Tree from String

You need to construct a binary tree from a string consisting of parenthesis and integers.

The whole input represents a binary tree. It contains an integer followed by zero, one or two pairs of parenthesis. The integer represents the root’s value and a pair of parenthesis contains a child binary tree with the same structure.

You always start to construct the left child node of the parent first if it exists.


There will only be ‘(‘, ‘)’, ‘-‘ and ‘0’ ~ ‘9’ in the input string.
An empty tree is represented by “” instead of “()”.




Nothing in this world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. The slogan Press On! has solved and always will solve the problems of the human race