{"id":2452,"date":"2022-01-28T17:12:35","date_gmt":"2022-01-28T09:12:35","guid":{"rendered":"http:\/\/139.9.1.231\/?p=2452"},"modified":"2022-01-28T17:12:36","modified_gmt":"2022-01-28T09:12:36","slug":"leetcodeday100","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/01\/28\/leetcodeday100\/","title":{"rendered":"leetcodeday100 -\u76f8\u540c\u7684\u6811"},"content":{"rendered":"\n<p>\u7ed9\u4f60\u4e24\u68f5\u4e8c\u53c9\u6811\u7684\u6839\u8282\u70b9&nbsp;<code>p<\/code>&nbsp;\u548c&nbsp;<code>q<\/code>&nbsp;\uff0c\u7f16\u5199\u4e00\u4e2a\u51fd\u6570\u6765\u68c0\u9a8c\u8fd9\u4e24\u68f5\u6811\u662f\u5426\u76f8\u540c\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4e24\u4e2a\u6811\u5728\u7ed3\u6784\u4e0a\u76f8\u540c\uff0c\u5e76\u4e14\u8282\u70b9\u5177\u6709\u76f8\u540c\u7684\u503c\uff0c\u5219\u8ba4\u4e3a\u5b83\u4eec\u662f\u76f8\u540c\u7684\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image is-style-default\"><img src=\"https:\/\/assets.leetcode.com\/uploads\/2020\/12\/20\/ex1.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u8f93\u5165\uff1a<\/strong>p = &#91;1,2,3], q = &#91;1,2,3]\n<strong>\u8f93\u51fa\uff1a<\/strong>true<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># @lc app=leetcode.cn id=100 lang=python3\r\n#\r\n# &#91;100] \u76f8\u540c\u7684\u6811\r\n#\r\n\r\n# @lc code=start\r\n# Definition for a binary tree node.\r\n# 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\r\nclass Solution:\r\n    def isSameTree(self, p: TreeNode, q: TreeNode) -> bool:\r\n        def issame(p,q):\r\n            if p==None and q==None:\r\n                return\r\n            if p==None and q!=None:\r\n                return False\r\n            if p!=None and q==None:\r\n                return False\r\n            if p.val==q.val:\r\n                if issame(p.left,q.left)==False or issame(p.right,q.right)==False:\r\n                    return False\r\n            else:\r\n                return False\r\n        print(issame(p,q))\r\n        return True if issame(p,q)==None else False\r\n# @lc code=end<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" width=\"880\" height=\"237\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-304.png\" alt=\"\" class=\"wp-image-2453\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-304.png 880w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-304-300x81.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/01\/image-304-768x207.png 768w\" sizes=\"(max-width: 880px) 100vw, 880px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img src=\"https:\/\/w.wallhaven.cc\/full\/q2\/wallhaven-q255qd.jpg\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed9\u4f60\u4e24\u68f5\u4e8c\u53c9\u6811\u7684\u6839\u8282\u70b9&nbsp;p&nbsp;\u548c&nbsp;q&nbsp;\uff0c\u7f16\u5199\u4e00\u4e2a\u51fd\u6570\u6765\u68c0\u9a8c\u8fd9\u4e24\u68f5\u6811\u662f\u5426\u76f8 &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/01\/28\/leetcodeday100\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">leetcodeday100 -\u76f8\u540c\u7684\u6811<\/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\/2452"}],"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=2452"}],"version-history":[{"count":2,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2452\/revisions"}],"predecessor-version":[{"id":2455,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2452\/revisions\/2455"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=2452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=2452"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=2452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}