当前位置: 首页 > news >正文

内蒙古建设住房与城乡厅官方网站织梦网站文章发布模板下载

内蒙古建设住房与城乡厅官方网站,织梦网站文章发布模板下载,企业网络营销策划方案设计的例子,福州百度seo文章目录1. 题目2. 解题1. 题目 给定一个用字符串表示的整数的嵌套列表#xff0c;实现一个解析它的语法分析器。 列表中的每个元素只可能是整数或整数嵌套列表 提示#xff1a;你可以假定这些字符串都是格式良好的#xff1a; 字符串非空 字符串不包含空格 字符串只包含… 文章目录1. 题目2. 解题1. 题目 给定一个用字符串表示的整数的嵌套列表实现一个解析它的语法分析器。 列表中的每个元素只可能是整数或整数嵌套列表 提示你可以假定这些字符串都是格式良好的 字符串非空 字符串不包含空格 字符串只包含数字0-9、[、-、,、]示例 1 给定 s 324, 你应该返回一个 NestedInteger 对象其中只包含整数值 324。示例 2 给定 s [123,[456,[789]]], 返回一个 NestedInteger 对象包含一个有两个元素的嵌套列表1. 一个 integer 包含值 123 2. 一个包含两个元素的嵌套列表i. 一个 integer 包含值 456ii. 一个包含一个元素的嵌套列表a. 一个 integer 包含值 789来源力扣LeetCode 链接https://leetcode-cn.com/problems/mini-parser 著作权归领扣网络所有。商业转载请联系官方授权非商业转载请注明出处。 2. 解题 /*** // This is the interface that allows for creating nested lists.* // You should not implement it, or speculate about its implementation* class NestedInteger {* public:* // Constructor initializes an empty nested list.* NestedInteger();** // Constructor initializes a single integer.* NestedInteger(int value);** // Return true if this NestedInteger holds a single integer, rather than a nested list.* bool isInteger() const;** // Return the single integer that this NestedInteger holds, if it holds a single integer* // The result is undefined if this NestedInteger holds a nested list* int getInteger() const;** // Set this NestedInteger to hold a single integer.* void setInteger(int value);** // Set this NestedInteger to hold a nested list and adds a nested integer to it.* void add(const NestedInteger ni);** // Return the nested list that this NestedInteger holds, if it holds a nested list* // The result is undefined if this NestedInteger holds a single integer* const vectorNestedInteger getList() const;* };*/ class Solution { public:NestedInteger deserialize(string s) {if(s[0] ! [)return NestedInteger(stoi(s));stackNestedInteger stk;string num;for(int i 0; i s.size(); i){if(s[i] [)stk.push(NestedInteger());else if(isdigit(s[i]) || s[i]-){num s[i];}else // , ]{if(!num.empty()){stk.top().add(NestedInteger(stoi(num)));num.clear();}if(s[i]] stk.size()1){NestedInteger t stk.top();stk.pop();stk.top().add(t);}}}return stk.top();} };16 ms 11.2 MB C 我的CSDN博客地址 https://michael.blog.csdn.net/ 长按或扫码关注我的公众号Michael阿明一起加油、一起学习进步
http://www.pierceye.com/news/1404/

相关文章:

  • 做微商如何网站推广wordpress 修改注册地址
  • 天堂软件天津软件优化公司排名前十
  • 提供网站备案建设服务给别人做网站的公司
  • 网站制作 公司资质it培训机构怎么样
  • 网站开发人员职业分析常州做的网站的公司
  • 临沂网站设计建设打开陕西建设厅网站
  • 明年做哪个网站能致富北京网站建设工作
  • 推广的网站有哪些百度直播间
  • 商业网站网页建网站 可以看到访客吗
  • 唐山哪个公司可以建网站山西省建设厅网站见证员证书宋来增
  • 有哪些网站可以做网站游戏做几个网站好
  • 免费网站制作 优帮云广州越秀区有什么好玩的地方
  • 怎么做网站后缀识别符号才不会变网站建设明细报价表模板
  • 天津个人做网站权重域名做网站有用么
  • 深圳做网站乐云seo费用优惠网站搜索功能
  • 赤峰网站建设招聘wordpress qq登录插件
  • 语言可以做网站吗外贸公司属于什么企业
  • 如何运营一个网站wordpress 部署报错
  • 一个网站如何做外链怎么免费制作一个企业网站
  • 嘉兴住房和城乡建设厅网站uc做购物网站
  • 三亚 网站建设12380网站建设情况汇报
  • 网站建设与管理试题一东莞如何建网站费用
  • 无锡网站建设系统中国学校网站前台模板
  • 工信部网站备案密码wordpress怎么开启多站点
  • 金融投资公司网站模板营销策略都有哪些4p
  • 一个购物交易网站怎么做创建网站赚钱
  • 3合一网站怎么做企业电子商务网站
  • 华侨城网站建设网站空间流量是什么
  • wordpress做的外贸网站6全自动推广引流软件免费
  • 制作收款网站如何自己建个人网站