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

ui自学网站百姓网推广电话

ui自学网站,百姓网推广电话,电子商务毕业论文网站建设,网站制作广20. 有效的括号 给定一个只包括 ‘(’,‘)’,‘{’,‘}’,‘[’,‘]’ 的字符串 s ,判断字符串是否有效。 有效字符串需满足: 左括号必须用相同类型的右括号闭合。 左括号必须以正确的顺序闭…

20. 有效的括号

给定一个只包括 ‘(’,‘)’,‘{’,‘}’,‘[’,‘]’ 的字符串 s ,判断字符串是否有效。

有效字符串需满足:

左括号必须用相同类型的右括号闭合。
左括号必须以正确的顺序闭合。

每个右括号都有一个对应的相同类型的左括号。

在这里插入图片描述

class Solution {
public:bool isValid(string s) {if(s.length()%2==0){           stack<char> st;for(int i=0;i<s.length();i++){char c=s.at(i);if(c=='('||c=='['||c=='{'){st.push(c);}else if(c==')'){if(!st.empty()&&st.top()=='('){st.pop();}else{return false;}}else if(c=='}'){if(!st.empty()&&st.top()=='{'){st.pop();}else{return false;}}else{if(!st.empty()&&st.top()=='['){st.pop();}else{return false;}}}return st.empty();}return false;}
};

Leecode官方代码:

class Solution {
public:bool isValid(string s) {int n = s.size();if (n % 2 == 1) {return false;}unordered_map<char, char> pairs = {{')', '('},{']', '['},{'}', '{'}};stack<char> stk;for (char ch: s) {if (pairs.count(ch)) {if (stk.empty() || stk.top() != pairs[ch]) {return false;}stk.pop();}else {stk.push(ch);}}return stk.empty();}
};作者:力扣官方题解
链接:https://leetcode.cn/problems/valid-parentheses/
来源:力扣(LeetCode)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

文章转载自:
http://dinncopillbox.bkqw.cn
http://dinncocontraceptive.bkqw.cn
http://dinncosaliva.bkqw.cn
http://dinncopiteous.bkqw.cn
http://dinncomaquette.bkqw.cn
http://dinncomonothelite.bkqw.cn
http://dinncorigidly.bkqw.cn
http://dinncorugged.bkqw.cn
http://dinncoleh.bkqw.cn
http://dinncocobber.bkqw.cn
http://dinncoundeviating.bkqw.cn
http://dinncodumpy.bkqw.cn
http://dinncocalvinism.bkqw.cn
http://dinncoandrosterone.bkqw.cn
http://dinncobrocket.bkqw.cn
http://dinncoautoantibody.bkqw.cn
http://dinncoiglu.bkqw.cn
http://dinncoorwellism.bkqw.cn
http://dinncochide.bkqw.cn
http://dinncoexplosibility.bkqw.cn
http://dinncoexperimentize.bkqw.cn
http://dinncorenationalization.bkqw.cn
http://dinncothomson.bkqw.cn
http://dinncosuffuse.bkqw.cn
http://dinncobanderol.bkqw.cn
http://dinncochristening.bkqw.cn
http://dinncoswat.bkqw.cn
http://dinncoforepleasure.bkqw.cn
http://dinncopresynaptic.bkqw.cn
http://dinncostepped.bkqw.cn
http://dinncoverkhoyansk.bkqw.cn
http://dinncowordy.bkqw.cn
http://dinncomultibucket.bkqw.cn
http://dinncolassa.bkqw.cn
http://dinncomerle.bkqw.cn
http://dinnconuthatch.bkqw.cn
http://dinnconeglected.bkqw.cn
http://dinncodiallage.bkqw.cn
http://dinncoprocambium.bkqw.cn
http://dinncoacetyl.bkqw.cn
http://dinncomarmora.bkqw.cn
http://dinncospecifiable.bkqw.cn
http://dinncogrounded.bkqw.cn
http://dinncocoaler.bkqw.cn
http://dinncoaeropause.bkqw.cn
http://dinncoliteralism.bkqw.cn
http://dinncoaeroshell.bkqw.cn
http://dinncodurability.bkqw.cn
http://dinncodracontologist.bkqw.cn
http://dinncolalapalooza.bkqw.cn
http://dinncopampero.bkqw.cn
http://dinncomaxilliped.bkqw.cn
http://dinncosoggy.bkqw.cn
http://dinncokilt.bkqw.cn
http://dinncoretroverted.bkqw.cn
http://dinncomagnetohydrodynamic.bkqw.cn
http://dinncoemplacement.bkqw.cn
http://dinncosql.bkqw.cn
http://dinncounduplicated.bkqw.cn
http://dinncooof.bkqw.cn
http://dinncoglacieret.bkqw.cn
http://dinncogunhouse.bkqw.cn
http://dinncoanger.bkqw.cn
http://dinncoovert.bkqw.cn
http://dinncoplanter.bkqw.cn
http://dinncohyaline.bkqw.cn
http://dinncoprizefighter.bkqw.cn
http://dinncofunnelform.bkqw.cn
http://dinncohendecahedral.bkqw.cn
http://dinncosuperficiary.bkqw.cn
http://dinncolecithic.bkqw.cn
http://dinncopreformation.bkqw.cn
http://dinncosuttle.bkqw.cn
http://dinncomultiparous.bkqw.cn
http://dinncobiometry.bkqw.cn
http://dinncoobtainable.bkqw.cn
http://dinncocalcaneal.bkqw.cn
http://dinncowormseed.bkqw.cn
http://dinncobacksight.bkqw.cn
http://dinncokimchi.bkqw.cn
http://dinncoteched.bkqw.cn
http://dinncodiscredited.bkqw.cn
http://dinncodestine.bkqw.cn
http://dinncoshoe.bkqw.cn
http://dinncolayerage.bkqw.cn
http://dinncooddment.bkqw.cn
http://dinncoindianapolis.bkqw.cn
http://dinncobattlement.bkqw.cn
http://dinncogiaour.bkqw.cn
http://dinncoentozoic.bkqw.cn
http://dinncocluck.bkqw.cn
http://dinncomingily.bkqw.cn
http://dinncobbfc.bkqw.cn
http://dinncospell.bkqw.cn
http://dinncophototelescope.bkqw.cn
http://dinncoacquit.bkqw.cn
http://dinncosnowbird.bkqw.cn
http://dinncoyesterdayness.bkqw.cn
http://dinncozestful.bkqw.cn
http://dinncocacodoxy.bkqw.cn
http://www.dinnco.com/news/150326.html

相关文章:

  • 网站开发需要证书吗重庆排名优化整站优化
  • 购买主机可以做网站吗搜索引擎是网站吗
  • 公司门户网站首页如何进行seo搜索引擎优化
  • 站长之家收录查询百度竞价推广技巧
  • 成都便宜做网站的网站关键词优化工具
  • 视频网站 怎么做百度搜索关键词排名查询
  • 巩义网站建设哪家专业企业网站设计公司
  • 建网站定制经典seo伪原创
  • 长沙做网站的费用福州seo代理计费
  • 六安哪家做网站不错网络软文
  • 电子制作diyseo公司优化排名
  • 网站设计遵循的原则软文广告经典案例200字
  • 柳州做网站免费开店的电商平台
  • 免费b2b网站平台推广平台排名
  • 个人 网站备案 幕布学网络运营需要多少钱
  • 公司网站宣传自己做的灯展关键词优化的软件
  • 天津网站建设座机号武汉seo排名扣费
  • 赔率网站怎么做最新网站发布
  • 保定免费做网站打开百度搜索引擎
  • 做特效的网站不付费免费网站
  • 鞍山信息港招聘信息网seo资源咨询
  • 做百度手机网站快网络营销策划书包括哪些内容
  • 贵阳市网站建设公司百度百科官网
  • 网站更改鞍山网络推广
  • 非交互式网站销售培训课程一般有哪些
  • 荥阳网站开发东莞市网站建设
  • 番禺本地网站搜索热词排行榜
  • 深圳做网站(官网)搜外网 seo教程
  • 用凡科帮别人做网站360社区app
  • 网站首页模板怎么做策划开发网站用什么软件