tag:blogger.com,1999:blog-8522573717713847738.post4066696225334297951..comments2024-03-28T00:14:29.070-07:00Comments on Yu's Coding Garden : leetcode Question 120: Valid ParenthesesAnonymoushttp://www.blogger.com/profile/00263085222060621782noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8522573717713847738.post-42268584766643656842020-06-26T09:39:44.497-07:002020-06-26T09:39:44.497-07:00At the top put this corner case this will reduce t...At the top put this corner case this will reduce time complexity more than4 time like from 5ms to 1ms.<br />.<br />if(s.size()%2!=0)<br /> return false;rahulhttps://www.blogger.com/profile/16731377653598601263noreply@blogger.comtag:blogger.com,1999:blog-8522573717713847738.post-77651031187731688462017-01-29T22:51:30.437-08:002017-01-29T22:51:30.437-08:00There is an error
In line 12,13 .. } instead of {...There is an error<br /><br />In line 12,13 .. } instead of { and ] instead of [<br /><br /> if ((s[i]=='}') && (st.top()!='{')) {return false;}<br /> if ((s[i]==']') && (st.top()!='[')) {return false;}<br />Rahulhttps://www.blogger.com/profile/02669228950496119077noreply@blogger.com