<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> class TreeNode ( object ) : <EOL> def __init__ ( self , val ) : <EOL> self . val = val <EOL> self . left , self . right = None , None <EOL> class Solution ( object ) : <EOL> def maxTree ( self , A ) : <EOL> """<STR_LIT>""" <EOL> stk = [ ] <EOL> for a in A : <EOL> cur = TreeNode ( a ) <EOL> while stk and stk [ - <NUM_LIT:1> ] . val <= cur . val : <EOL> pre = stk . pop ( ) <EOL> pre . right = cur . left <EOL> cur . left = pre <EOL> stk . append ( cur ) <EOL> pre = None <EOL> while stk : <EOL> cur = stk . pop ( ) <EOL> cur . right = pre <EOL> pre = cur <EOL> return pre </s>
