{"id":2037,"date":"2022-01-14T17:03:49","date_gmt":"2022-01-14T09:03:49","guid":{"rendered":"http:\/\/139.9.1.231\/?p=2037"},"modified":"2022-01-14T17:03:50","modified_gmt":"2022-01-14T09:03:50","slug":"leetcodeday","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/01\/14\/leetcodeday\/","title":{"rendered":"leetcodeday &#8211;22\u62ec\u53f7\u751f\u6210"},"content":{"rendered":"\n<p>\u6570\u5b57&nbsp;<code>n<\/code>&nbsp;\u4ee3\u8868\u751f\u6210\u62ec\u53f7\u7684\u5bf9\u6570\uff0c\u8bf7\u4f60\u8bbe\u8ba1\u4e00\u4e2a\u51fd\u6570\uff0c\u7528\u4e8e\u80fd\u591f\u751f\u6210\u6240\u6709\u53ef\u80fd\u7684\u5e76\u4e14&nbsp;<strong>\u6709\u6548\u7684&nbsp;<\/strong>\u62ec\u53f7\u7ec4\u5408\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u8f93\u5165\uff1a<\/strong>n = 3\n<strong>\u8f93\u51fa\uff1a<\/strong>&#91;\"((()))\",\"(()())\",\"(())()\",\"()(())\",\"()()()\"]<\/code><\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u8f93\u5165\uff1a<\/strong>n = 1\n<strong>\u8f93\u51fa\uff1a<\/strong>&#91;\"()\"]<\/code><\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul><li><code>1 &lt;= n &lt;= 8<\/code><\/li><\/ul>\n\n\n\n<p>\u601d\u8def\uff1a\u9012\u5f52\uff0c\u5bf9\u4e8e\u6bcf\u5bf9\uff08\uff09=>\u4e0b\u4e00\u6b21\u4f1a\u53d8\u6210 \uff08\uff09\uff08\uff09 or \uff08\uff08\uff09\uff09<\/p>\n\n\n\n<p>\u56e0\u6b64\u627e\u5230\u6240\u6709\u7684\u62ec\u53f7\u5bf9\u7684\u9996\u5c3e\u4f4d\u7f6e\uff0c\u7136\u540e\u8fdb\u884c\u66ff\u6362\u5c31ok<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># &#91;22] \u62ec\u53f7\u751f\u6210\r\n#\r\n\r\n# @lc code=start\r\nclass Solution:\r\n    def generateParenthesis(self, n: int) -> List&#91;str]:\r\n        def gpt(n):\r\n            if n == 1:\r\n                return &#91;\"()\"]\r\n            List=gpt(n-1)\r\n            lens=len(List)\r\n            l1,rev=list(),list()\r\n            for i in range(lens):\r\n                s1=List&#91;i]\r\n                 #Z=&#91;]\r\n                l1.append((0,s1&#91;0]))\r\n                for i in range(1,len(s1)):\r\n                    if s1&#91;i]==\")\":\r\n             \r\n                        y=l1.pop()&#91;0]\r\n                        #Z.append((y,x))\r\n                        rev.append(s1&#91;0:i+1]+\"()\"+s1&#91;i+1:])\r\n                        rev.append(s1&#91;0:y+1]+\"()\"+s1&#91;y+1:])\r\n            \r\n\r\n                    else: l1.append((i,s1&#91;i]))\r\n            return list(set(rev))\r\n        return gpt(n)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" width=\"876\" height=\"162\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-219.png\" alt=\"\" class=\"wp-image-2039\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-219.png 876w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-219-300x55.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-219-768x142.png 768w\" sizes=\"(max-width: 876px) 100vw, 876px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u6570\u5b57&nbsp;n&nbsp;\u4ee3\u8868\u751f\u6210\u62ec\u53f7\u7684\u5bf9\u6570\uff0c\u8bf7\u4f60\u8bbe\u8ba1\u4e00\u4e2a\u51fd\u6570\uff0c\u7528\u4e8e\u80fd\u591f\u751f\u6210\u6240\u6709\u53ef\u80fd\u7684\u5e76\u4e14&nbsp;\u6709\u6548 &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/01\/14\/leetcodeday\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">leetcodeday &#8211;22\u62ec\u53f7\u751f\u6210<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2037"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=2037"}],"version-history":[{"count":2,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2037\/revisions"}],"predecessor-version":[{"id":2041,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2037\/revisions\/2041"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=2037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=2037"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=2037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}