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/341.Flatten-Nested-List-Iterator/Readme.md at master · wisdompeak/LeetCode

Expand file tree

/

Readme.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
10 lines (5 loc) · 626 Bytes
/

Readme.md

Copy path

File metadata and controls

10 lines (5 loc) · 626 Bytes
Raw
Copy raw file
Download raw file
Edit and raw actions

341.Flatten-Nested-List-Iterator

仔细分析数据结构的定义。vector<NestedInteger>包含的是元素是NestedInteger类型. 当对元素做.getInteger()操作后得到的才是整形;做.getList()操作后得到的是vector<NestedInteger>类型。

设计一个stack<NestedInteger>Stack的堆栈。

hasNext()的目的,就是将Stack的栈顶元素不断展开(如果对应的是List数据的话),直至栈顶元素isInteger()为止。则下一步的next()就是读取栈顶元素并抽取整形数据,同时退栈。

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.