{"id":7511,"date":"2023-07-14T17:22:09","date_gmt":"2023-07-14T09:22:09","guid":{"rendered":"https:\/\/www.5x44.cn\/?p=7511"},"modified":"2023-07-14T17:22:09","modified_gmt":"2023-07-14T09:22:09","slug":"%e6%a0%b9%e6%8d%ae%e6%95%b0%e7%bb%84%e5%85%83%e7%b4%a0%e5%bb%ba%e7%ab%8b%e4%ba%8c%e5%8f%89%e6%a0%91","status":"publish","type":"post","link":"https:\/\/www.5x44.cn\/?p=7511","title":{"rendered":"\u6839\u636e\u6570\u7ec4\u5143\u7d20\u5efa\u7acb\u4e8c\u53c9\u6811"},"content":{"rendered":"\n<p>\u5efa\u7acb\u539f\u5219\u662f\u4ece\u4e0a\u5230\u4e0b\uff0c\u4ece\u5de6\u5230\u53f3\uff0c\u4e5f\u5c31\u662f\u5148\u5efa\u7acb\u6839\u7ed3\u70b9\uff0c\u7136\u540e\u662f\u6839\u7684\u5de6\u8282\u70b9\uff0c\u7136\u540e\u662f\u6839\u7684\u53f3\u8282\u70b9\uff08PS:\u8fd9\u91cc\u5199\u7684\u662f\u5de6\u8282\u70b9\uff0c\u800c\u6ca1\u5199\u5de6\u5b50\u6811\uff0c\u4e5f\u5c31\u662f\u53ea\u6709\u4e00\u4e2a\u8282\u70b9\u5e76\u4e0d\u5305\u542b\u8be5\u8282\u70b9\u4e0b\u9762\u7684\u8282\u70b9\uff09\uff0c\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[1,0,0,null,3]\n       1\n      \/ \\\n     0   0\n      \\\n       3<\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>class TreeNode:\r\n    def __init__(self, val=0, left=None, right=None):\r\n        self.val = val\r\n        self.left = left\r\n        self.right = right\n\ndef createTree(arr:list&#91;int])->TreeNode:\r\n    i=0\r\n    root=TreeNode(arr&#91;i])\r\n    TreeNodeQueue=&#91;root]\r\n    i+=1\r\n    while i&lt;len(arr):\r\n        Node=TreeNodeQueue.pop(0)\r\n        if arr&#91;i] is not None:\r\n            Node.left=TreeNode(arr&#91;i])\r\n            TreeNodeQueue.append(Node.left)\r\n\r\n        i+=1\r\n        if i>=len(arr):\r\n            break\r\n\r\n        if arr&#91;i] is not None:\r\n            Node.right=TreeNode(arr&#91;i])\r\n            TreeNodeQueue.append(Node.right)\r\n\r\n        i+=1\r\n    return root\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5efa\u7acb\u539f\u5219\u662f\u4ece\u4e0a\u5230\u4e0b\uff0c\u4ece\u5de6\u5230\u53f3\uff0c\u4e5f\u5c31\u662f\u5148\u5efa\u7acb\u6839\u7ed3\u70b9\uff0c\u7136\u540e\u662f\u6839\u7684\u5de6\u8282\u70b9\uff0c\u7136\u540e\u662f\u6839\u7684\u53f3\u8282\u70b9\uff08PS:\u8fd9\u91cc\u5199\u7684\u662f\u5de6\u8282\u70b9\uff0c\u800c\u6ca1\u5199\u5de6\u5b50\u6811\uff0c\u4e5f\u5c31\u662f\u53ea\u6709\u4e00\u4e2a\u8282\u70b9\u5e76\u4e0d\u5305\u542b\u8be5\u8282\u70b9\u4e0b\u9762&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.5x44.cn\/?p=7511\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-7511","post","type-post","status-publish","format-standard","hentry","category-python3"],"_links":{"self":[{"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/posts\/7511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7511"}],"version-history":[{"count":2,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/posts\/7511\/revisions"}],"predecessor-version":[{"id":7514,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=\/wp\/v2\/posts\/7511\/revisions\/7514"}],"wp:attachment":[{"href":"https:\/\/www.5x44.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.5x44.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}