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

http reverse proxy

1. pound




2. squid

# /etc/squid/squid.conf

# same public IP for ceph.minggr.net, www.example.com, example.com

http_port 80 vhost

cache_peer parent 80 0 no-query originserver name=server_1
acl sites_server_1 dstdomain ceph.minggr.net
cache_peer_access server_1 allow sites_server_1

cache_peer parent 80 0 no-query originserver name=server_2
acl sites_server_2 dstdomain www.example.com example.com
cache_peer_access server_2 allow sites_server_2