GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — LeetCode/Stack/536.Construct-Binary-Tree-from-String at master · wisdompeak/LeetCode

Expand file tree

/

536.Construct-Binary-Tree-from-String

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

536.Construct-Binary-Tree-from-String

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
536.Construct Binary Tree from String.cpp
536.Construct Binary Tree from String.cpp
 
 
Readme.md
Readme.md
 
 

Readme.md

536.Construct-Binary-Tree-from-String

典型的栈的应用。创建 stack<TreeNode*>Stack.

遇到左括号就把current入栈;

遇到右括号就退栈一个元素作为current的父节点:根据规则,current优先作为左子节点,如果父节点已经有左子节点,则current作为它的右子节点。然后更新current为此时的那个父节点。

遇到数字串,则开辟新节点current并赋值。注意负号。

Leetcode Link

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.